Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ensure shared example groups are reset after a run (as example groups…

… are).
  • Loading branch information...
commit 8e8fb2b3af4422327e676d4e1c344268357f3536 1 parent b94ec20
@justinko justinko authored
View
1  Changelog.md
@@ -5,6 +5,7 @@ Bug fixes
* Restore `--full_backtrace` option
* Ensure that values passed to `config.filter_run` are respected when running
over DRb (using spork).
+* Ensure shared example groups are reset after a run (as example groups are).
### 2.8.0 / 2012-01-04
View
14 lib/rspec/core/world.rb
@@ -4,12 +4,13 @@ class World
include RSpec::Core::Hooks
- attr_reader :example_groups, :filtered_examples, :wants_to_quit
- attr_writer :wants_to_quit
+ attr_reader :example_groups, :shared_example_groups, :filtered_examples
+ attr_accessor :wants_to_quit
def initialize(configuration=RSpec.configuration)
@configuration = configuration
@example_groups = [].extend(Extensions::Ordered)
+ @shared_example_groups = {}
@filtered_examples = Hash.new { |hash,group|
hash[group] = begin
examples = group.examples.dup
@@ -22,6 +23,7 @@ def initialize(configuration=RSpec.configuration)
def reset
example_groups.clear
+ shared_example_groups.clear
end
def filter_manager
@@ -45,12 +47,10 @@ def configure_group(group)
@configuration.configure_group(group)
end
- def shared_example_groups
- @shared_example_groups ||= {}
- end
-
def example_count
- example_groups.collect {|g| g.descendants}.flatten.inject(0) { |sum, g| sum += g.filtered_examples.size }
+ example_groups.collect {|g| g.descendants}.flatten.inject(0) do |sum, g|
+ sum += g.filtered_examples.size
+ end
end
def preceding_declaration_line(filter_line)
View
2  spec/rspec/core/world_spec.rb
@@ -64,7 +64,7 @@ module RSpec::Core
context "with two exaples and the second example is registre first" do
@dchelimsky Owner

Looks like we need a spelling validator on strings passed to describe, context, it, etc.

lol you committed it: a368a1a#L1R181

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
let(:second_group_declaration_line) { second_group.metadata[:example_group][:line_number] }
- before do
+ before do
world.register(second_group)
world.register(group)
end

2 comments on commit 8e8fb2b

@dchelimsky
Owner

No specs for this?

@justinko

There's never been a spec for it. I'll add one now.

Please sign in to comment.
Something went wrong with that request. Please try again.