Browse files

Changed ViewExampleGroup to use template as the implicit subject by d…

…efault

[#686]
  • Loading branch information...
1 parent dd82685 commit 382f1d4dc5bd2f2cec719cae870e4d5f4f60f48b @jferris jferris committed with Feb 7, 2009
Showing with 19 additions and 0 deletions.
  1. +7 −0 lib/spec/rails/example/view_example_group.rb
  2. +12 −0 spec/spec/rails/example/view_example_group_spec.rb
View
7 lib/spec/rails/example/view_example_group.rb
@@ -48,6 +48,13 @@ def forget_variables_added_to_assigns
# end
class ViewExampleGroup < FunctionalExampleGroup
tests ViewExampleGroupController
+ class << self
+ def inherited(klass) # :nodoc:
+ klass.subject { template }
+ super
+ end
+ end
+
before(:each) do
ensure_that_flash_and_session_work_properly
end
View
12 spec/spec/rails/example/view_example_group_spec.rb
@@ -177,6 +177,18 @@ def render!
render "view_spec/accessor"
end
+ it "should use the template as the implicit subject" do
+ subject.should == template
+ end
+
+ describe "with a specified subject" do
+ subject { 'specified' }
+
+ it "should use the specified subject" do
+ subject.should == 'specified'
+ end
+ end
+
it "should have access to session data" do
response.should have_tag("div#session", "session")
end

0 comments on commit 382f1d4

Please sign in to comment.