On Oct 22, 2007, at 12:18 AM, Steve wrote: > On Tue, 09 Oct 2007 21:12:09 +0100, Matt Patterson wrote: > >> It occured to me that it would be nice to have a spec that would barf >> if I ever nuked the layout's yield (or, indeed, one of its >> content_for yields), mainly because they're the integration point >> between layouts and views, and we're primarily testing them in >> isolation (a good thing...) >> >> I was mainly wondering if anyone had some great practices in testing >> those integration points, and layout stuff in general, that I could >> learn from... >> >> Matt > > Was there ever any resolution on this? This would be a *very* > beneficial > capability to have for making sure views work as expected. > > Thanks, > Steve > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
I'm not sure if this is what you're after but I've created this custom matcher to my spec_helper.rb, then in my controller spec I can say it "should use application layout" do do_it response.should use_layout("application") end # custom matchers #--------------------- class UseLayout def initialize(expected) @expected = 'layouts/' + expected end def matches?(controller) @actual = controller.layout [EMAIL PROTECTED](@expected) @actual == @expected end def failure_message return "use_layout expected [EMAIL PROTECTED], got # [EMAIL PROTECTED]", @expected, @actual end def negeative_failure_message return "use_layout expected [EMAIL PROTECTED] not to equal # [EMAIL PROTECTED]", @expected, @actual end end def use_layout(expected) UseLayout.new(expected) end _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users