Permalink
Browse files

GH#34 - Fail fast support

  • Loading branch information...
spicycode committed Oct 2, 2010
1 parent 6557d68 commit 43ed741fe06944fc7615ad84572db027469523fc
Showing with 7 additions and 1 deletion.
  1. +1 −0 lib/rspec/core/configuration.rb
  2. +5 −1 lib/rspec/core/example_group.rb
  3. +1 −0 spec/spec_helper.rb
@@ -25,6 +25,7 @@ def self.add_setting(name, opts={})
add_setting :drb_port
add_setting :color_enabled
add_setting :profile_examples
+ add_setting :fail_fast, :default => false
add_setting :run_all_when_everything_filtered
add_setting :mock_framework, :default => :rspec
add_setting :filter
@@ -239,7 +239,11 @@ def self.run_examples(instance, reporter)
filtered_examples.map do |example|
begin
set_ivars(instance, before_all_ivars)
- example.run(instance, reporter)
+ succeeded = example.run(instance, reporter)
+ if Rspec.configuration.fail_fast? && !succeeded
+ Rspec.wants_to_quit = true
+ end
+ succeeded
ensure
clear_ivars(instance)
clear_memoized(instance)
View
@@ -54,6 +54,7 @@ def in_editor?
end
RSpec.configure do |c|
+ c.fail_fast = true
c.color_enabled = !in_editor?
c.filter_run :focused => true
c.run_all_when_everything_filtered = true

0 comments on commit 43ed741

Please sign in to comment.