rspec-core 2.13.1 → 2.14.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/Changelog.md +80 -0
  2. data/exe/autospec +1 -1
  3. data/features/README.md +2 -2
  4. data/features/command_line/format_option.feature +8 -14
  5. data/features/command_line/line_number_appended_to_path.feature +4 -4
  6. data/features/command_line/line_number_option.feature +1 -1
  7. data/features/command_line/rake_task.feature +2 -2
  8. data/features/command_line/require_option.feature +43 -0
  9. data/features/command_line/ruby.feature +2 -2
  10. data/features/command_line/warnings_option.feature +27 -0
  11. data/features/configuration/backtrace_clean_patterns.feature +2 -2
  12. data/features/configuration/deprecation_stream.feature +58 -0
  13. data/features/configuration/pattern.feature +8 -0
  14. data/features/configuration/profile.feature +59 -2
  15. data/features/configuration/read_options_from_file.feature +8 -5
  16. data/features/configuration/run_all_when_everything_filtered.feature +20 -4
  17. data/features/example_groups/basic_structure.feature +1 -1
  18. data/features/example_groups/shared_context.feature +1 -1
  19. data/features/example_groups/shared_examples.feature +72 -0
  20. data/features/filtering/exclusion_filters.feature +10 -10
  21. data/features/formatters/custom_formatter.feature +1 -1
  22. data/features/hooks/before_and_after_hooks.feature +19 -19
  23. data/features/mock_framework_integration/use_any_framework.feature +6 -6
  24. data/features/mock_framework_integration/use_flexmock.feature +3 -3
  25. data/features/mock_framework_integration/use_mocha.feature +3 -3
  26. data/features/mock_framework_integration/use_rr.feature +3 -3
  27. data/features/mock_framework_integration/use_rspec.feature +3 -3
  28. data/features/subject/implicit_subject.feature +1 -1
  29. data/lib/rspec/core.rb +20 -3
  30. data/lib/rspec/core/backtrace_cleaner.rb +46 -0
  31. data/lib/rspec/core/backward_compatibility.rb +3 -13
  32. data/lib/rspec/core/configuration.rb +136 -49
  33. data/lib/rspec/core/configuration_options.rb +19 -8
  34. data/lib/rspec/core/deprecation.rb +18 -30
  35. data/lib/rspec/core/example.rb +3 -3
  36. data/lib/rspec/core/example_group.rb +4 -3
  37. data/lib/rspec/core/extensions/kernel.rb +1 -1
  38. data/lib/rspec/core/filter_manager.rb +1 -1
  39. data/lib/rspec/core/formatters.rb +1 -1
  40. data/lib/rspec/core/formatters/base_formatter.rb +10 -1
  41. data/lib/rspec/core/formatters/base_text_formatter.rb +47 -10
  42. data/lib/rspec/core/formatters/deprecation_formatter.rb +35 -0
  43. data/lib/rspec/core/formatters/helpers.rb +12 -5
  44. data/lib/rspec/core/formatters/html_formatter.rb +7 -6
  45. data/lib/rspec/core/formatters/html_printer.rb +13 -12
  46. data/lib/rspec/core/formatters/json_formatter.rb +1 -2
  47. data/lib/rspec/core/formatters/text_mate_formatter.rb +1 -1
  48. data/lib/rspec/core/hooks.rb +9 -0
  49. data/lib/rspec/core/memoized_helpers.rb +19 -8
  50. data/lib/rspec/core/metadata.rb +3 -1
  51. data/lib/rspec/core/mocking/with_flexmock.rb +1 -1
  52. data/lib/rspec/core/mocking/with_rr.rb +1 -1
  53. data/lib/rspec/core/option_parser.rb +6 -2
  54. data/lib/rspec/core/pending.rb +1 -0
  55. data/lib/rspec/core/rake_task.rb +11 -19
  56. data/lib/rspec/core/reporter.rb +33 -4
  57. data/lib/rspec/core/shared_example_group.rb +56 -16
  58. data/lib/rspec/core/shared_example_group/collection.rb +42 -0
  59. data/lib/rspec/core/version.rb +1 -1
  60. data/lib/rspec/core/world.rb +2 -3
  61. data/spec/autotest/rspec_spec.rb +2 -2
  62. data/spec/rspec/core/backtrace_cleaner_spec.rb +68 -0
  63. data/spec/rspec/core/configuration_options_spec.rb +15 -4
  64. data/spec/rspec/core/configuration_spec.rb +202 -19
  65. data/spec/rspec/core/deprecation_spec.rb +41 -0
  66. data/spec/rspec/core/deprecations_spec.rb +10 -12
  67. data/spec/rspec/core/drb_command_line_spec.rb +1 -1
  68. data/spec/rspec/core/example_group_spec.rb +37 -36
  69. data/spec/rspec/core/example_spec.rb +25 -4
  70. data/spec/rspec/core/filter_manager_spec.rb +6 -6
  71. data/spec/rspec/core/formatters/base_text_formatter_spec.rb +101 -36
  72. data/spec/rspec/core/formatters/deprecation_formatter_spec.rb +78 -0
  73. data/spec/rspec/core/formatters/documentation_formatter_spec.rb +2 -2
  74. data/spec/rspec/core/formatters/helpers_spec.rb +23 -7
  75. data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +20 -14
  76. data/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html +69 -169
  77. data/spec/rspec/core/formatters/html_formatted-1.8.7.html +28 -23
  78. data/spec/rspec/core/formatters/html_formatted-1.9.2.html +42 -33
  79. data/spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html +17 -23
  80. data/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html +57 -157
  81. data/spec/rspec/core/formatters/html_formatted-1.9.3.html +42 -33
  82. data/spec/rspec/core/formatters/html_formatted-2.0.0.html +42 -33
  83. data/spec/rspec/core/formatters/html_formatter_spec.rb +1 -0
  84. data/spec/rspec/core/formatters/progress_formatter_spec.rb +3 -3
  85. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +11 -14
  86. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-rbx.html +103 -203
  87. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +30 -25
  88. data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +42 -33
  89. data/spec/rspec/core/formatters/text_mate_formatted-1.9.3-jruby.html +20 -14
  90. data/spec/rspec/core/formatters/text_mate_formatted-1.9.3-rbx.html +103 -203
  91. data/spec/rspec/core/formatters/text_mate_formatted-1.9.3.html +42 -33
  92. data/spec/rspec/core/formatters/text_mate_formatted-2.0.0.html +42 -33
  93. data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +1 -0
  94. data/spec/rspec/core/memoized_helpers_spec.rb +28 -0
  95. data/spec/rspec/core/metadata_spec.rb +8 -3
  96. data/spec/rspec/core/option_parser_spec.rb +8 -0
  97. data/spec/rspec/core/project_initializer_spec.rb +2 -2
  98. data/spec/rspec/core/rake_task_spec.rb +8 -8
  99. data/spec/rspec/core/reporter_spec.rb +26 -6
  100. data/spec/rspec/core/resources/formatter_specs.rb +3 -3
  101. data/spec/rspec/core/shared_context_spec.rb +20 -0
  102. data/spec/rspec/core/shared_example_group/collection_spec.rb +70 -0
  103. data/spec/rspec/core/shared_example_group_spec.rb +4 -4
  104. data/spec/rspec/core/world_spec.rb +1 -3
  105. data/spec/rspec/core_spec.rb +20 -0
  106. data/spec/spec_helper.rb +29 -29
  107. data/spec/support/helper_methods.rb +9 -1
  108. data/spec/support/isolate_load_path_mutation.rb +6 -0
  109. data/spec/support/sandboxed_mock_space.rb +100 -0
  110. metadata +28 -13
  111. data/features/filtering/run_all_when_everything_filtered.feature +0 -46
  112. data/lib/rspec/core/load_path.rb +0 -3
@@ -1,3 +1,83 @@
1
+ ### 2.14.0.rc1 / 2013-05-27
2
+ [full changelog](http://github.com/rspec/rspec-core/compare/v2.13.1...v2.14.0.rc1)
3
+
4
+ Enhancements
5
+
6
+ * Improved Windows detection inside Git Bash, for better `--color` handling.
7
+ * Add profiling of the slowest example groups to `--profile` option.
8
+ The output is sorted by the slowest average example groups.
9
+ * Don't show slow examples if there's a failure and both `--fail-fast`
10
+ and `--profile` options are used (Paweł Gościcki).
11
+ * Rather than always adding `spec` to the load path, add the configured
12
+ `--default-path` to the load path (which defaults to `spec`). This
13
+ better supports folks who choose to put their specs in a different
14
+ directory (John Feminella).
15
+ * Add some logic to test time duration precision. Make it a
16
+ function of time, dropping precision as the time increases. (Aaron Kromer)
17
+ * Add new `backtrace_inclusion_patterns` config option. Backtrace lines
18
+ that match one of these patterns will _always_ be included in the
19
+ backtrace, even if they match an exclusion pattern, too (Sam Phippen).
20
+ * Support ERB trim mode using the `-` when parsing `.rspec` as ERB
21
+ (Gabor Garami).
22
+ * Give a better error message when let and subject are called without a block.
23
+ (Sam Phippen).
24
+ * List the precedence of `.rspec-local` in the configuration documentation
25
+ (Sam Phippen)
26
+ * Support `{a,b}` shell expansion syntax in `--pattern` option
27
+ (Konstantin Haase).
28
+ * Add cucumber documentation for --require command line option
29
+ (Bradley Schaefer)
30
+ * Expose configruation options via config:
31
+ * `config.libs` returns the libs configured to be added onto the load path
32
+ * `full_backtrace?` returns the state of the backtrace cleaner
33
+ * `debug?` returns true when the debugger is loaded
34
+ * `line_numbers` returns the line numbers we are filtering by (if any)
35
+ * `full_description` returns the RegExp used to filter descriptions
36
+ (Jon Rowe)
37
+ * Add setters for RSpec.world and RSpec.configuration (Alex Soulim)
38
+ * Configure ruby's warning behaviour with `--warnings` (Jon Rowe)
39
+ * Fix an obscure issue on old versions of `1.8.7` where `Time.dup` wouldn't
40
+ allow access to `Time.now` (Jon Rowe)
41
+ * Make `shared_examples_for` context aware, so that keys may be safely reused
42
+ in multiple contexts without colliding. (Jon Rowe)
43
+ * Add a configurable `deprecation_stream` (Jon Rowe)
44
+ * Publish deprecations through a formatter (David Chelimsky)
45
+
46
+ Bug fixes
47
+
48
+ * Make JSON formatter behave the same when it comes to `--profile` as
49
+ the text formatter (Paweł Gościcki).
50
+ * Fix named subjects so that if an inner group defines a method that
51
+ overrides the named method, `subject` still retains the originally
52
+ declared value (Myron Marston).
53
+ * Fix random ordering so that it does not cause `rand` in examples in
54
+ nested sibling contexts to return the same value (Max Shytikov).
55
+ * Use the new `backtrace_inclusion_patterns` config option to ensure
56
+ that folks who develop code in a directory matching one of the default
57
+ exclusion patterns (e.g. `gems`) still get the normal backtrace
58
+ filtering (Sam Phippen).
59
+ * Fix ordering of `before` hooks so that `before` hooks declared in
60
+ `RSpec.configure` run before `before` hooks declared in a shared
61
+ context (Michi Huber and Tejas Dinkar).
62
+ * Fix `Example#full_description` so that it gets filled in by the last
63
+ matcher description (as `Example#description` already did) when no
64
+ doc string has been provided (David Chelimsky).
65
+ * Fix the memoized methods (`let` and `subject`) leaking `define_method`
66
+ as a `public` method. (Thomas Holmes and Jon Rowe) (#873)
67
+ * Fix warnings coming from the test suite. (Pete Higgins)
68
+
69
+ Deprecations
70
+
71
+ * Deprecate `Configuration#backtrace_clean_patterns` in favor of
72
+ `Configuration#backtrace_exclusion_patterns` for greater consistency
73
+ and symmetry with new `backtrace_inclusion_patterns` config option
74
+ (Sam Phippen).
75
+ * Deprecate `Configuration#requires=` in favor of using ruby's
76
+ `require`. Requires specified by the command line can still be
77
+ accessed by the `Configuration#require` reader. (Bradley Schaefer)
78
+ * Deprecate calling `SharedExampleGroups` defined across sibling contexts
79
+ (Jon Rowe)
80
+
1
81
  ### 2.13.1 / 2013-03-12
2
82
  [full changelog](http://github.com/rspec/rspec-core/compare/v2.13.0...v2.13.1)
3
83
 
@@ -6,7 +6,7 @@ REMOVAL NOTICE: you are using behaviour that has been
6
6
  removed from rspec-2.
7
7
 
8
8
  * The 'autospec' command is no longer supported.
9
- * Please use 'autotest' insted.
9
+ * Please use 'autotest' instead.
10
10
 
11
11
  This message will be removed from a future version of rspec.
12
12
  ************************************************************
@@ -2,8 +2,8 @@ rspec-core provides the structure for RSpec code examples:
2
2
 
3
3
  describe Account do
4
4
  it "has a balance of zero when first opened" do
5
- # example code goes here - for more on the
6
- # code inside the examples, see rspec-expectations
5
+ # example code goes here - for more on the
6
+ # code inside the examples, see rspec-expectations
7
7
  # and rspec-mocks
8
8
  end
9
9
  end
@@ -2,30 +2,24 @@ Feature: --format option
2
2
 
3
3
  Use the --format option to tell RSpec how to format the output.
4
4
 
5
- RSpec ships with a few formatters built in. By default, it uses the progress
5
+ RSpec ships with several formatters built in. By default, it uses the progress
6
6
  formatter, which generates output like this:
7
7
 
8
8
  ....F.....*.....
9
9
 
10
10
  A '.' represents a passing example, 'F' is failing, and '*' is pending.
11
11
 
12
- To see the documentation strings passed to each describe(), context(), and it()
13
- method, use the documentation formatter:
12
+ Use the documentation formatter to see the documentation strings passed to
13
+ `describe`, `it`, and their aliases:
14
14
 
15
15
  $ rspec spec --format documentation
16
16
 
17
- You can also specify an output target (STDOUT by default) by appending a
18
- filename to the argument:
17
+ You can also specify an output target ($stdout by default) with an --out
18
+ option immediately following the --format option:
19
19
 
20
- $ rspec spec --format documentation --out rspec.txt
20
+ $ rspec spec --format documentation --out rspec.txt
21
21
 
22
- `rspec --help` lists available formatters:
23
-
24
- [p]rogress (default - dots)
25
- [d]ocumentation (group and example names)
26
- [h]tml
27
- [t]extmate
28
- custom formatter class name
22
+ Run `rspec --help` to see a listing of available formatters.
29
23
 
30
24
  Background:
31
25
  Given a file named "example_spec.rb" with:
@@ -69,7 +63,7 @@ Feature: --format option
69
63
  does something that is pending (PENDING: No reason given)
70
64
  """
71
65
 
72
- Scenario: multiple formats
66
+ Scenario: multiple formats and output targets
73
67
  When I run `rspec example_spec.rb --format progress --format documentation --out rspec.txt`
74
68
  Then the output should contain ".F*"
75
69
  And the file "rspec.txt" should contain:
@@ -3,7 +3,7 @@ Feature: line number appended to file path
3
3
  To run one or more examples or groups, you can append the line number to the path, e.g.
4
4
 
5
5
  rspec path/to/example_spec.rb:37
6
-
6
+
7
7
  Background:
8
8
  Given a file named "example_spec.rb" with:
9
9
  """ruby
@@ -12,17 +12,17 @@ Feature: line number appended to file path
12
12
  it "first example in outer group" do
13
13
 
14
14
  end
15
-
15
+
16
16
  it "second example in outer group" do
17
17
 
18
18
  end
19
19
 
20
20
  describe "nested group" do
21
-
21
+
22
22
  it "example in nested group" do
23
23
 
24
24
  end
25
-
25
+
26
26
  end
27
27
 
28
28
  end
@@ -49,7 +49,7 @@ Feature: --line_number option
49
49
  it { should be > 8 }
50
50
 
51
51
  it { should be < 10 }
52
-
52
+
53
53
  end
54
54
  """
55
55
  When I run `rspec example_spec.rb --line_number 5 --format doc`
@@ -1,5 +1,5 @@
1
1
  Feature: rake task
2
-
2
+
3
3
  RSpec ships with a rake task with a number of useful options
4
4
 
5
5
  Scenario: default options with passing spec (prints command and exit status is 0)
@@ -42,7 +42,7 @@ Feature: rake task
42
42
  """
43
43
  When I run `rake`
44
44
  Then the exit status should be 1
45
-
45
+
46
46
  Scenario: fail_on_error = false with failing spec (exit status is 0)
47
47
  Given a file named "Rakefile" with:
48
48
  """ruby
@@ -0,0 +1,43 @@
1
+ Feature: --require option
2
+
3
+ Use the `--require` (or `-r`) option to specify a file to require
4
+ before running specs.
5
+
6
+ Scenario: using the --require option
7
+ Given a file named "logging_formatter.rb" with:
8
+ """ruby
9
+ require "rspec/core/formatters/base_text_formatter"
10
+ require 'delegate'
11
+
12
+ class LoggingFormatter < RSpec::Core::Formatters::BaseTextFormatter
13
+ def initialize(output)
14
+ super LoggingIO.new(output)
15
+ end
16
+
17
+ class LoggingIO < SimpleDelegator
18
+ def initialize(output)
19
+ @file = File.new('rspec.log', 'w')
20
+ super
21
+ end
22
+
23
+ def puts(message)
24
+ [@file, __getobj__].each { |out| out.puts message }
25
+ end
26
+
27
+ def close
28
+ @file.close
29
+ end
30
+ end
31
+ end
32
+ """
33
+ And a file named "spec/example_spec.rb" with:
34
+ """ruby
35
+ describe "an embarassing situation" do
36
+ it "happens to everyone" do
37
+ end
38
+ end
39
+ """
40
+ When I run `rspec --require ./logging_formatter.rb --format LoggingFormatter`
41
+ Then the output should contain "1 example, 0 failures"
42
+ And the file "rspec.log" should contain "1 example, 0 failures"
43
+ And the exit status should be 0
@@ -1,8 +1,8 @@
1
1
  Feature: run with ruby command
2
2
 
3
3
  You can use the `ruby` command to run specs. You just need to require
4
- `rspec/autorun`.
5
-
4
+ `rspec/autorun`.
5
+
6
6
  Generally speaking, you're better off using the `rspec` command, which
7
7
  requires `rspec/autorun` for you, but some tools only work with the `ruby`
8
8
  command.
@@ -0,0 +1,27 @@
1
+ Feature: run with warnings enabled
2
+
3
+ You can use the `--warnings` option to run specs with warnings enabled
4
+
5
+ Scenario:
6
+ Given a file named "example_spec.rb" with:
7
+ """ruby
8
+ describe do
9
+ it 'generates warning' do
10
+ @undefined
11
+ end
12
+ end
13
+ """
14
+ When I run `rspec --warnings example_spec.rb`
15
+ Then the output should contain "warning"
16
+
17
+ Scenario:
18
+ Given a file named "example_spec.rb" with:
19
+ """ruby
20
+ describe do
21
+ it 'generates warning' do
22
+ @undefined
23
+ end
24
+ end
25
+ """
26
+ When I run `rspec example_spec.rb`
27
+ Then the output should not contain "warning"
@@ -56,7 +56,7 @@ Feature: Backtrace cleaning
56
56
  RSpec::Matchers.define :be_baz do |_|
57
57
  match do |actual|
58
58
  actual == "baz"
59
- end
59
+ end
60
60
  end
61
61
  """
62
62
  And a file named "spec/example_spec.rb" with:
@@ -82,7 +82,7 @@ Feature: Backtrace cleaning
82
82
  RSpec::Matchers.define :be_baz do |_|
83
83
  match do |actual|
84
84
  actual == "baz"
85
- end
85
+ end
86
86
  end
87
87
  """
88
88
  And a file named "spec/example_spec.rb" with:
@@ -0,0 +1,58 @@
1
+ Feature: deprecation_stream
2
+
3
+ Define a custom output stream for warning about deprecations (default `$stderr`).
4
+
5
+ RSpec.configure {|c| c.deprecation_stream = File.open('deprecations.txt', 'w') }
6
+
7
+ or
8
+
9
+ RSpec.configure {|c| c.deprecation_stream = 'deprecations.txt' }
10
+
11
+ Background:
12
+ Given a file named "lib/foo.rb" with:
13
+ """ruby
14
+ class Foo
15
+ def bar
16
+ RSpec.deprecate "Foo#bar"
17
+ end
18
+ end
19
+ """
20
+
21
+ Scenario: default - print deprecations to $stderr
22
+ Given a file named "spec/example_spec.rb" with:
23
+ """ruby
24
+ require "foo"
25
+ describe "calling a deprecated method" do
26
+ example { Foo.new.bar }
27
+ end
28
+ """
29
+ When I run `rspec spec/example_spec.rb`
30
+ Then the output should contain "DEPRECATION: Foo#bar is deprecated"
31
+
32
+ Scenario: configure using the path to a file
33
+ Given a file named "spec/example_spec.rb" with:
34
+ """ruby
35
+ require "foo"
36
+ RSpec.configure {|c| c.deprecation_stream = 'deprecations.txt' }
37
+ describe "calling a deprecated method" do
38
+ example { Foo.new.bar }
39
+ end
40
+ """
41
+ When I run `rspec spec/example_spec.rb`
42
+ Then the output should not contain "DEPRECATION"
43
+ But the output should contain "1 deprecation logged to deprecations.txt"
44
+ And the file "deprecations.txt" should contain "Foo#bar is deprecated"
45
+
46
+ Scenario: configure using a File object
47
+ Given a file named "spec/example_spec.rb" with:
48
+ """ruby
49
+ require "foo"
50
+ RSpec.configure {|c| c.deprecation_stream = File.open('deprecations.txt', 'w') }
51
+ describe "calling a deprecated method" do
52
+ example { Foo.new.bar }
53
+ end
54
+ """
55
+ When I run `rspec spec/example_spec.rb`
56
+ Then the output should not contain "DEPRECATION"
57
+ But the output should contain "1 deprecation logged to deprecations.txt"
58
+ And the file "deprecations.txt" should contain "Foo#bar is deprecated"
@@ -28,3 +28,11 @@ Feature: pattern
28
28
  Scenario: the --pattern flag makes RSpec run files matching the specified pattern and ignore the default pattern
29
29
  When I run `rspec -P "**/*_test.rb"`
30
30
  Then the output should contain "1 example, 0 failures"
31
+
32
+ Scenario: the --pattern flag can be used to pass in multiple patterns, separated by comma
33
+ When I run `rspec -P "**/*_test.rb,**/*_spec.rb"`
34
+ Then the output should contain "3 examples, 0 failures"
35
+
36
+ Scenario: the --pattern flag accepts shell style glob unions
37
+ When I run `rspec -P "**/*_{test,spec}.rb"`
38
+ Then the output should contain "3 examples, 0 failures"
@@ -4,7 +4,8 @@ Feature: Profile examples
4
4
  `#profile_examples`), when set, will cause RSpec to dump out a list of
5
5
  your slowest examples. By default, it prints the 10 slowest examples,
6
6
  but you can set it to a different value to have it print more or fewer
7
- slow examples.
7
+ slow examples. If `--fail-fast` option is used together with `--profile`
8
+ and there is a failure, slow examples are not shown.
8
9
 
9
10
  Background:
10
11
  Given a file named "spec/spec_helper.rb" with:
@@ -15,7 +16,7 @@ Feature: Profile examples
15
16
  require "spec_helper"
16
17
 
17
18
  describe "something" do
18
- it "sleeps for 0.1 secionds (example 1)" do
19
+ it "sleeps for 0.1 seconds (example 1)" do
19
20
  sleep 0.1
20
21
  1.should == 1
21
22
  end
@@ -161,3 +162,59 @@ Feature: Profile examples
161
162
  And the output should not contain "example 10"
162
163
  And the output should not contain "example 11"
163
164
 
165
+ Scenario: Using `--profile` with `--fail-fast` shows slow examples if everything passes
166
+ When I run `rspec spec --fail-fast --profile`
167
+ Then the examples should all pass
168
+ And the output should contain "Top 10 slowest examples"
169
+ And the output should contain "example 1"
170
+ And the output should not contain "example 2"
171
+ And the output should contain "example 3"
172
+ And the output should contain "example 4"
173
+ And the output should contain "example 5"
174
+ And the output should contain "example 6"
175
+ And the output should contain "example 7"
176
+ And the output should contain "example 8"
177
+ And the output should contain "example 9"
178
+ And the output should contain "example 10"
179
+ And the output should contain "example 11"
180
+
181
+ Scenario: Using `--profile` shows slow examples even in case of failures
182
+ Given a file named "spec/example_spec.rb" with:
183
+ """ruby
184
+ require "spec_helper"
185
+
186
+ describe "something" do
187
+ it "sleeps for 0.1 seconds (example 1)" do
188
+ sleep 0.1
189
+ 1.should == 1
190
+ end
191
+
192
+ it "fails" do
193
+ fail
194
+ end
195
+ end
196
+ """
197
+ When I run `rspec spec --profile`
198
+ Then the output should contain "2 examples, 1 failure"
199
+ And the output should contain "Top 2 slowest examples"
200
+ And the output should contain "example 1"
201
+
202
+ Scenario: Using `--profile` with `--fail-fast` doesn't show slow examples in case of failures
203
+ Given a file named "spec/example_spec.rb" with:
204
+ """ruby
205
+ require "spec_helper"
206
+
207
+ describe "something" do
208
+ it "sleeps for 0.1 seconds (example 1)" do
209
+ sleep 0.1
210
+ 1.should == 1
211
+ end
212
+
213
+ it "fails" do
214
+ fail
215
+ end
216
+ end
217
+ """
218
+ When I run `rspec spec --fail-fast --profile`
219
+ Then the output should not contain "Top 2 slowest examples"
220
+ And the output should not contain "example 1"