Browse files

Make JSON formatter behave the same as text formatter

When it comes to `--profile` and `--fail-fast`.
  • Loading branch information...
1 parent eb8546a commit b7ca8f87be04285ffaad84d9ce2f44eb660e398c @pjg pjg committed Mar 9, 2013
Showing with 6 additions and 2 deletions.
  1. +2 −0 Changelog.md
  2. +4 −2 lib/rspec/core/formatters/json_formatter.rb
View
2 Changelog.md
@@ -14,6 +14,8 @@ Enhancements
Bug fixes
+* Make JSON formatter behave the same when it comes to `--profile` as
+ the text formatter (Paweł Gościcki).
* Fix named subjects so that if an inner group defines a method that
overrides the named method, `subject` still retains the originally
declared value (Myron Marston).
View
6 lib/rspec/core/formatters/json_formatter.rb
@@ -28,8 +28,10 @@ def dump_summary(duration, example_count, failure_count, pending_count)
}
@output_hash[:summary_line] = summary_line(example_count, failure_count, pending_count)
- # Don't print out profiled info if there are failures, it just clutters the output
- dump_profile if profile_examples? && failure_count == 0
+ # Don't print out profiled info if there are failures and `--fail-fast` is used, it just clutters the output
+ if profile_examples? && (!fail_fast? || fail_fast? && failure_count == 0)
+ dump_profile
+ end
end
def summary_line(example_count, failure_count, pending_count)

0 comments on commit b7ca8f8

Please sign in to comment.