Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed ControllerExampleGroup to use controller as the implicit subj…

…ect by default

[#686]
  • Loading branch information...
commit 5d114beefcaabdb225de9f83f9406407f1df73a0 1 parent 382f1d4
@jferris jferris authored committed
View
1  lib/spec/rails/example/controller_example_group.rb
@@ -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
View
12 spec/spec/rails/example/controller_example_group_spec.rb
@@ -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'
Please sign in to comment.
Something went wrong with that request. Please try again.