Skip to content

Instantly share code, notes, and snippets.

@xirukitepe
Created November 7, 2012 06:54
Show Gist options
  • Save xirukitepe/4029899 to your computer and use it in GitHub Desktop.
Save xirukitepe/4029899 to your computer and use it in GitHub Desktop.
example usage of assert_select and
describe "home page" do
it "displays the user's username after successful login" do
user = User.create!(:username => "jdoe", :password => "secret")
get "/login"
assert_select "form.login" do
assert_select "input[name=?]", "username"
assert_select "input[name=?]", "password"
assert_select "input[type=?]", "submit"
end
post "/login", :username => "jdoe", :password => "secret"
assert_select ".header .username", :text => "jdoe"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment