Skip to content

Commit

Permalink
Merge branch 'anonymous_controller_route_helpers'
Browse files Browse the repository at this point in the history
  • Loading branch information
alindeman committed Jan 4, 2014
2 parents cff0228 + b731d91 commit 1c2461d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions lib/rspec/rails/example/controller_example_group.rb
Expand Up @@ -68,9 +68,8 @@ def self.name
end end
metadata[:example_group][:described_class].class_eval(&body) metadata[:example_group][:described_class].class_eval(&body)


orig_routes = nil
before do before do
orig_routes = self.routes @orig_routes = self.routes
resource_name = @controller.respond_to?(:controller_name) ? resource_name = @controller.respond_to?(:controller_name) ?
@controller.controller_name.to_sym : :anonymous @controller.controller_name.to_sym : :anonymous
self.routes = ActionDispatch::Routing::RouteSet.new.tap { |r| self.routes = ActionDispatch::Routing::RouteSet.new.tap { |r|
Expand All @@ -79,7 +78,7 @@ def self.name
end end


after do after do
self.routes = orig_routes self.routes = @orig_routes
@orig_routes = nil @orig_routes = nil
end end
end end
Expand Down
6 changes: 3 additions & 3 deletions spec/spec_helper.rb
Expand Up @@ -19,16 +19,16 @@ def self.run_all(reporter=nil)
end end


RSpec.configure do |config| RSpec.configure do |config|
real_world = nil

config.filter_run :focus config.filter_run :focus
config.run_all_when_everything_filtered = true config.run_all_when_everything_filtered = true
config.order = :random

real_world = nil
config.before(:each) do config.before(:each) do
real_world = RSpec.world real_world = RSpec.world
RSpec.instance_variable_set(:@world, RSpec::Core::World.new) RSpec.instance_variable_set(:@world, RSpec::Core::World.new)
end end
config.after(:each) do config.after(:each) do
RSpec.instance_variable_set(:@world, real_world) RSpec.instance_variable_set(:@world, real_world)
end end
config.order = :random
end end

0 comments on commit 1c2461d

Please sign in to comment.