Skip to content

Instantly share code, notes, and snippets.

@alloy-d
Created February 13, 2012 02:03
Show Gist options
  • Save alloy-d/1812751 to your computer and use it in GitHub Desktop.
Save alloy-d/1812751 to your computer and use it in GitHub Desktop.
state :start do
transition [
"need to log in",
"ready to post a job",
]
end
state "need to log in" do
if !body.index("log in") return false
transition [
"log in if known",
"log in if unknown",
]
end
state "log in if known" do
return false unless (form = selector("form#loginKnown"))
# perform logic to fill in form...
transition [ "ready to post job" ]
end
state "log in if unknown" do
return false unless (form = selector("form#login"))
# perform logic to fill in form...
transition [ "ready to post job" ]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment