Permalink
Browse files

config.seed always returns the @seed value

Moved the responsibility of not reporting a seed if not randomizing
to CommandLine.
  • Loading branch information...
1 parent 529d467 commit 9da117ba6a49dddcfd7a1d5db189b40905da2a51 @dchelimsky dchelimsky committed Oct 30, 2011
Showing with 5 additions and 21 deletions.
  1. +1 −1 lib/rspec/core/command_line.rb
  2. +1 −3 lib/rspec/core/configuration.rb
  3. +3 −17 spec/rspec/core/configuration_spec.rb
@@ -18,7 +18,7 @@ def run(err, out)
@configuration.load_spec_files
@world.announce_filters
- @configuration.reporter.report(@world.example_count, @configuration.seed) do |reporter|
+ @configuration.reporter.report(@world.example_count, @configuration.randomize? ? @configuration.seed : nil) do |reporter|
begin
@configuration.run_hook(:before, :suite)
@world.example_groups.ordered.map {|g| g.run(reporter)}.all? ? 0 : @configuration.failure_exit_code
@@ -530,9 +530,7 @@ def load_spec_files
raise_if_rspec_1_is_loaded
end
- def seed
- @seed if randomize?
- end
+ attr_reader :seed
def seed=(seed)
@order = 'rand'
@@ -955,23 +955,9 @@ def metadata_hash(*args)
end
describe '#seed' do
- context 'with order set to :random' do
- before do
- config.order = :random
- config.seed = 123
- end
-
- it 'returns the seed' do
- config.seed.should eq(123)
- end
- end
-
- context 'with order set to nil' do
- before { config.order = nil }
-
- it 'returns nil' do
- config.seed.should be_nil
- end
+ it 'returns the seed as an int' do
+ config.seed = '123'
+ config.seed.should eq(123)
end
end

0 comments on commit 9da117b

Please sign in to comment.