Commit a6c3dc3827dc4dcc25bd6192789fad046993978f
- Date: Mon Mar 17 09:22:46 +0000 2008
- Committer: David Chelimsky (dchelimsky@gmail.com)
- Author: Pat Maddox (pat.maddox@gmail.com)
- Commit SHA1: a6c3dc3827dc4dcc25bd6192789fad046993978f
- Tree SHA1: 2289bd2bad967182aaf9504053ece9c32ebf2b25
propogate controller_name in nested controller specs
Commit diff
| |   |
| 81 | 81 | end |
| 82 | 82 | |
| 83 | 83 | def inherited(klass) # :nodoc: |
| 84 | klass.controller_class_name = controller_class_name if controller_class_name |
| 84 | 85 | klass.integrate_views(integrate_views?) |
| 85 | 86 | super |
| 86 | 87 | end |
| toggle raw diff |
--- a/rspec_on_rails/lib/spec/rails/example/controller_example_group.rb
+++ b/rspec_on_rails/lib/spec/rails/example/controller_example_group.rb
@@ -81,6 +81,7 @@ module Spec
end
def inherited(klass) # :nodoc:
+ klass.controller_class_name = controller_class_name if controller_class_name
klass.integrate_views(integrate_views?)
super
end |
| |   |
| 42 | 42 | end |
| 43 | 43 | |
| 44 | 44 | describe "nested" do |
| 45 | | controller_name :controller_spec |
| 46 | | |
| 47 | 45 | it "should render a template" do |
| 48 | 46 | get 'action_with_template' |
| 49 | 47 | response.should be_success |
| … | … | |
| 49 | 49 | end |
| 50 | 50 | |
| 51 | 51 | describe "with integrate_views turned off" do |
| 52 | | controller_name :controller_spec |
| 53 | 52 | integrate_views false |
| 54 | 53 | |
| 55 | 54 | it "should not care if the template doesn't exist" do |
| toggle raw diff |
--- a/rspec_on_rails/spec/rails/example/controller_isolation_spec.rb
+++ b/rspec_on_rails/spec/rails/example/controller_isolation_spec.rb
@@ -42,8 +42,6 @@ describe "a controller spec running in integration mode", :type => :controller d
end
describe "nested" do
- controller_name :controller_spec
-
it "should render a template" do
get 'action_with_template'
response.should be_success
@@ -51,7 +49,6 @@ describe "a controller spec running in integration mode", :type => :controller d
end
describe "with integrate_views turned off" do
- controller_name :controller_spec
integrate_views false
it "should not care if the template doesn't exist" do |
| |   |
| 58 | 58 | controller.expect_render(:update).and_yield(template) |
| 59 | 59 | template.should_receive(:replace).with(:bottom, "replace_me", :partial => "non_existent_partial") |
| 60 | 60 | get 'action_with_render_update' |
| 61 | | puts response.body |
| 62 | 61 | end |
| 63 | 62 | |
| 64 | 63 | it "should allow a path relative to RAILS_ROOT/app/views/ when specifying a partial" do |
| … | … | |
| 176 | 176 | end |
| 177 | 177 | end |
| 178 | 178 | |
| 179 | describe "A controller spec with controller_name set", :type => :controller do |
| 180 | controller_name :controller_spec |
| 181 | |
| 182 | describe "nested" do |
| 183 | it "should inherit the controller name" do |
| 184 | get 'action_with_template' |
| 185 | response.should be_success |
| 186 | end |
| 187 | end |
| 188 | end |
| 189 | |
| 179 | 190 | module Spec |
| 180 | 191 | module Rails |
| 181 | 192 | module Example |
| toggle raw diff |
--- a/rspec_on_rails/spec/rails/example/controller_spec_spec.rb
+++ b/rspec_on_rails/spec/rails/example/controller_spec_spec.rb
@@ -58,7 +58,6 @@ require 'controller_spec_controller'
controller.expect_render(:update).and_yield(template)
template.should_receive(:replace).with(:bottom, "replace_me", :partial => "non_existent_partial")
get 'action_with_render_update'
- puts response.body
end
it "should allow a path relative to RAILS_ROOT/app/views/ when specifying a partial" do
@@ -177,6 +176,17 @@ describe ControllerSpecController, :type => :controller do
end
end
+describe "A controller spec with controller_name set", :type => :controller do
+ controller_name :controller_spec
+
+ describe "nested" do
+ it "should inherit the controller name" do
+ get 'action_with_template'
+ response.should be_success
+ end
+ end
+end
+
module Spec
module Rails
module Example |