I'm looking for any documentation or reference on how to do request specs (which I've also seen called 'integration tests') with rspec and rails.
The page here shows a snippet in the readme for "request specs" which is the sort of testing I'd like to do (full stack testing).
describe "widgets resource" do
describe "GET index" do
it "contains the widgets header" do
get "/widgets/index"
response.should have_selector("h1", :content => "Widgets")
end
end
end
Is there a reference for all the methods used in this style of testing, such as how to use fixtures, cookies, sessions, redirects, etc?
Actually, is there even an rdoc for the have_selector
method used above? I haven't been able to find an API or rdoc for this. Maybe I'm missing something.
Thanks!
have_selector is part of Webrat:
http://rubydoc.info/github/brynary/webrat/master/Webrat/Matchers
Capybara provides a larger range of matchers:
http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Matchers