Permalink
Browse files

use closure scope locals rather than ivars (eliminates warnings, Im n…

…ot sure why the ivars are bing lost)
  • Loading branch information...
1 parent e2e2ffa commit 86aea05ee0235153068e215ff3c71a0053a8444b @JonRowe JonRowe committed Sep 30, 2013
Showing with 7 additions and 4 deletions.
  1. +3 −2 lib/rspec/rails/example/controller_example_group.rb
  2. +4 −2 spec/spec_helper.rb
@@ -64,15 +64,16 @@ def self.name; "AnonymousController"; end
end
metadata[:example_group][:described_class].class_eval(&body)
+ orig_routes = nil
before do
- @orig_routes = self.routes
+ orig_routes = self.routes
self.routes = ActionDispatch::Routing::RouteSet.new.tap { |r|
r.draw { resources :anonymous }
}
end
after do
- self.routes = @orig_routes
+ self.routes = orig_routes
@orig_routes = nil
end
end
View
@@ -18,15 +18,17 @@ def self.run_all(reporter=nil)
end
RSpec.configure do |config|
+ real_world = nil
+
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run :focus
config.run_all_when_everything_filtered = true
config.before(:each) do
- @real_world = RSpec.world
+ real_world = RSpec.world
RSpec.instance_variable_set(:@world, RSpec::Core::World.new)
end
config.after(:each) do
- RSpec.instance_variable_set(:@world, @real_world)
+ RSpec.instance_variable_set(:@world, real_world)
end
config.order = :random
end

0 comments on commit 86aea05

Please sign in to comment.