Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

Commit

Permalink
Apply before_suite_parts *after* loading files! [#459 state:resolved …
Browse files Browse the repository at this point in the history
…milestone:"1.1.5"]
  • Loading branch information
dchelimsky committed Jul 12, 2008
1 parent c516321 commit 74fd2a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 10 additions & 4 deletions lib/spec/runner/options.rb
Expand Up @@ -54,7 +54,7 @@ class Options
:argv
)
attr_reader :colour, :differ_class, :files, :example_groups

def initialize(error_stream, output_stream)
@error_stream = error_stream
@output_stream = output_stream
Expand Down Expand Up @@ -89,16 +89,22 @@ def run_examples
return true unless examples_should_be_run?
success = true
begin
before_suite_parts.each do |part|
part.call
end
runner = custom_runner || ExampleGroupRunner.new(self)

unless @files_loaded
runner.load_files(files_to_load)
@files_loaded = true
end

# TODO - this has to happen after the files get loaded,
# otherwise the before_suite_parts are not populated
# from the configuration. There is no spec for this
# directly, but stories/configuration/before_blocks.story
# will fail if this happens before the files are loaded.
before_suite_parts.each do |part|
part.call
end

if example_groups.empty?
true
else
Expand Down
2 changes: 0 additions & 2 deletions stories/configuration/before_blocks.story
Expand Up @@ -13,8 +13,6 @@ Story: before suite

Scenario: running with spec

Given this scenario fails because before(:suite) doesn't get run with the spec command

Given the file ../resources/spec/before_blocks_example.rb

When I run it with the spec script
Expand Down

0 comments on commit 74fd2a7

Please sign in to comment.