Permalink
Browse files

minor tweaks to previous commit

  • Loading branch information...
1 parent aa1a079 commit 06517b0639d9c281aef6cff597e67fde49b41b4b @dchelimsky dchelimsky committed Apr 16, 2011
@@ -2,7 +2,7 @@ Feature: anonymous controller
Use the `controller` method to define an anonymous controller derived from
ApplicationController, or any other base controller. This is useful for
- spec'ing behavior such as global error handling.
+ specifying behavior like global error handling.
Scenario: specify error handling in ApplicationController
Given a file named "spec/controllers/application_controller_spec.rb" with:
@@ -148,8 +148,7 @@ def name
end
after do
- @routes = @orig_routes
- @orig_routes = nil
+ @routes, @orig_routes = @orig_routes, nil
end
end
end
@@ -159,7 +158,6 @@ module InstanceMethods
def method_missing(method, *args, &block)
if @orig_routes && @orig_routes.named_routes.helpers.include?(method)
- # Delegate to underlying controller
controller.send(method, *args, &block)
else
super
@@ -45,19 +45,19 @@ module RSpec::Rails
it "delegates named route helpers to the underlying controller" do
controller = double('controller')
- controller.should_receive(:foos_url).and_return('http://test.host/foos')
+ controller.stub(:foos_url).and_return('http://test.host/foos')
example = group.new
example.stub(:controller => controller)
# As in the routing example spec, this is pretty invasive, but not sure
# how to do it any other way as the correct operation relies on before
# hooks
- orig_routes = ActionDispatch::Routing::RouteSet.new
- orig_routes.draw { resources :foos }
- example.instance_variable_set(:@orig_routes, orig_routes)
+ routes = ActionDispatch::Routing::RouteSet.new
+ routes.draw { resources :foos }
+ example.instance_variable_set(:@orig_routes, routes)
- example.foos_url.should be
+ example.foos_url.should eq('http://test.host/foos')
end
end
end

0 comments on commit 06517b0

Please sign in to comment.