Skip to content

Instantly share code, notes, and snippets.

@sfkaos
Forked from them0nk/rspec_rails_cheetsheet.rb
Created February 24, 2014 21:48
Show Gist options
  • Save sfkaos/9197884 to your computer and use it in GitHub Desktop.
Save sfkaos/9197884 to your computer and use it in GitHub Desktop.
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
#Matchers
response.body.should have_content("Hello world")
response.body.should have_no_content("Hello world")
response.body.should have_selector("input") #checks for the presence of the input tag
response.body.should have_selector("input", :value =>"Twelve Angry Men") # checks for input tag with value
response.body.should have_no_selector("input")
response.body.should have_css("input#movie_title")
response.body.should have_css("input#movie_title", :value => "Twelve Angry Men")
response.body.should have_xpath("//a")
response.body.should have_xpath("//a",:href => "google.com")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment