Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

World.new accepts config

  • Loading branch information...
commit 2f32f7e6ef8c061e8563193350c2743b8cd2d822 1 parent 1b2163b
@dchelimsky dchelimsky authored
Showing with 10 additions and 13 deletions.
  1. +10 −13 lib/rspec/core/world.rb
View
23 lib/rspec/core/world.rb
@@ -4,7 +4,8 @@ class World
attr_reader :example_groups, :filtered_examples
- def initialize
+ def initialize(configuration=RSpec.configuration)
+ @configuration = configuration
@example_groups = []
@filtered_examples = Hash.new { |hash,group|
hash[group] = begin
@@ -16,20 +17,16 @@ def initialize
}
end
- def configuration
- RSpec.configuration
- end
-
def inclusion_filter
- configuration.filter
+ @configuration.filter
end
def exclusion_filter
- configuration.exclusion_filter
+ @configuration.exclusion_filter
end
def find_modules(group)
- configuration.find_modules(group)
+ @configuration.find_modules(group)
end
def shared_example_groups
@@ -58,12 +55,12 @@ def preceding_declaration_line(filter_line)
def announce_inclusion_filter
if inclusion_filter
- if RSpec.configuration.run_all_when_everything_filtered? && RSpec.world.example_count == 0
- RSpec.configuration.reporter.message "No examples were matched by #{inclusion_filter.inspect}, running all"
- RSpec.configuration.clear_inclusion_filter
+ if @configuration.run_all_when_everything_filtered? && RSpec.world.example_count == 0
+ @configuration.reporter.message "No examples were matched by #{inclusion_filter.inspect}, running all"
+ @configuration.clear_inclusion_filter
filtered_examples.clear
else
- RSpec.configuration.reporter.message "Run filtered using #{inclusion_filter.inspect}"
+ @configuration.reporter.message "Run filtered using #{inclusion_filter.inspect}"
end
end
end
@@ -71,7 +68,7 @@ def announce_inclusion_filter
include RSpec::Core::Hooks
def find_hook(hook, scope, group)
- RSpec.configuration.find_hook(hook, scope, group)
+ @configuration.find_hook(hook, scope, group)
end
private
Please sign in to comment.
Something went wrong with that request. Please try again.