Permalink
Browse files

Changed ControllerExampleGroup to use controller as the implicit subj…

…ect by default

[#686]
  • Loading branch information...
1 parent 382f1d4 commit 5d114beefcaabdb225de9f83f9406407f1df73a0 @jferris jferris committed with Feb 7, 2009
@@ -63,6 +63,7 @@ def integrate_views? # :nodoc:
def inherited(klass) # :nodoc:
klass.controller_class_name = controller_class_name
klass.integrate_views(integrate_views?)
+ klass.subject { controller }
super
end
@@ -5,6 +5,18 @@
describe "A controller example running in #{mode} mode", :type => :controller do
controller_name :controller_spec
integrate_views if mode == 'integration'
+
+ it "should use the controller as the implicit subject" do
+ subject.should == controller
+ end
+
+ describe "with a specified subject" do
+ subject { 'specified' }
+
+ it "should use the specified subject instead of the controller" do
+ subject.should == 'specified'
+ end
+ end
it "should provide controller.session as session" do
get 'action_with_template'

0 comments on commit 5d114be

Please sign in to comment.