Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…ot sure why the ivars are bing lost)
  • Loading branch information...
commit 86aea05ee0235153068e215ff3c71a0053a8444b 1 parent e2e2ffa
@JonRowe JonRowe authored
View
5 lib/rspec/rails/example/controller_example_group.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
6 spec/spec_helper.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.