Is there a way I can write something like a shared behaviour for all views that
just checks the page responds with a 200 status and has a title, meta tags, and
an h1?
Here''s an idea for a shared behaviour (that only applies if I set views
to use
it manually with it_should_behave_like "a standard layout"):
describe "a standard layout", :shared => true do
it "should have meta tags" do
do_render
response.should have_tag("meta")
end
it "should have an h1 tag" do
do_render
response.should have_tag("h1")
end
end
Note that this also sucks because I currently have to define a do_render that
calls render with a stringified name of the view I''m spec-ing. I also
get the
feeling that I might want to split this out into a shared behaviour for
controllers that checks if all of its pages respond with a 200 (like a
spider-crawling thing) and the rest should be in a view spec.
I''ve got a feeling this would go in spec_helper.rb, but I''m
not sure how to set
it up for all views and controllers. What''s the simplest way?
Thanks,
Edward