rspec-core 2.11.1 → 2.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/Changelog.md +59 -0
  2. data/README.md +22 -0
  3. data/features/command_line/example_name_option.feature +5 -5
  4. data/features/command_line/exit_status.feature +6 -6
  5. data/features/command_line/format_option.feature +2 -2
  6. data/features/command_line/line_number_appended_to_path.feature +2 -2
  7. data/features/command_line/line_number_option.feature +2 -2
  8. data/features/command_line/pattern_option.feature +2 -2
  9. data/features/command_line/rake_task.feature +62 -8
  10. data/features/command_line/ruby.feature +1 -1
  11. data/features/command_line/tag.feature +1 -1
  12. data/features/configuration/alias_example_to.feature +2 -2
  13. data/features/configuration/custom_settings.feature +3 -3
  14. data/features/configuration/default_path.feature +3 -3
  15. data/features/configuration/fail_fast.feature +5 -5
  16. data/features/configuration/read_options_from_file.feature +4 -4
  17. data/features/example_groups/basic_structure.feature +2 -2
  18. data/features/example_groups/shared_context.feature +3 -3
  19. data/features/example_groups/shared_examples.feature +25 -7
  20. data/features/expectation_framework_integration/configure_expectation_framework.feature +6 -6
  21. data/features/filtering/exclusion_filters.feature +5 -5
  22. data/features/filtering/if_and_unless.feature +5 -5
  23. data/features/filtering/inclusion_filters.feature +5 -5
  24. data/features/filtering/run_all_when_everything_filtered.feature +3 -3
  25. data/features/formatters/custom_formatter.feature +2 -2
  26. data/features/formatters/json_formatter.feature +30 -0
  27. data/features/formatters/text_formatter.feature +5 -5
  28. data/features/helper_methods/arbitrary_methods.feature +2 -2
  29. data/features/helper_methods/let.feature +2 -2
  30. data/features/helper_methods/modules.feature +6 -6
  31. data/features/hooks/around_hooks.feature +11 -11
  32. data/features/hooks/before_and_after_hooks.feature +15 -11
  33. data/features/hooks/filtering.feature +6 -6
  34. data/features/metadata/current_example.feature +1 -1
  35. data/features/metadata/described_class.feature +1 -1
  36. data/features/metadata/user_defined.feature +4 -4
  37. data/features/mock_framework_integration/use_any_framework.feature +6 -6
  38. data/features/mock_framework_integration/use_flexmock.feature +5 -5
  39. data/features/mock_framework_integration/use_mocha.feature +5 -5
  40. data/features/mock_framework_integration/use_rr.feature +5 -5
  41. data/features/mock_framework_integration/use_rspec.feature +5 -5
  42. data/features/pending/pending_examples.feature +11 -11
  43. data/features/spec_files/arbitrary_file_suffix.feature +1 -1
  44. data/features/step_definitions/additional_cli_steps.rb +2 -0
  45. data/features/subject/attribute_of_subject.feature +5 -5
  46. data/features/subject/explicit_subject.feature +5 -5
  47. data/features/subject/implicit_receiver.feature +2 -2
  48. data/features/subject/implicit_subject.feature +3 -3
  49. data/lib/autotest/rspec2.rb +1 -1
  50. data/lib/rspec/core.rb +53 -32
  51. data/lib/rspec/core/configuration.rb +123 -15
  52. data/lib/rspec/core/configuration_options.rb +17 -2
  53. data/lib/rspec/core/example.rb +5 -4
  54. data/lib/rspec/core/example_group.rb +19 -9
  55. data/lib/rspec/core/extensions/ordered.rb +12 -6
  56. data/lib/rspec/core/formatters.rb +55 -0
  57. data/lib/rspec/core/formatters/base_formatter.rb +43 -38
  58. data/lib/rspec/core/formatters/base_text_formatter.rb +9 -5
  59. data/lib/rspec/core/formatters/documentation_formatter.rb +1 -1
  60. data/lib/rspec/core/formatters/helpers.rb +30 -5
  61. data/lib/rspec/core/formatters/html_formatter.rb +58 -368
  62. data/lib/rspec/core/formatters/html_printer.rb +407 -0
  63. data/lib/rspec/core/formatters/json_formatter.rb +73 -0
  64. data/lib/rspec/core/formatters/snippet_extractor.rb +3 -1
  65. data/lib/rspec/core/hooks.rb +4 -4
  66. data/lib/rspec/core/metadata.rb +14 -6
  67. data/lib/rspec/core/mocking/with_mocha.rb +25 -2
  68. data/lib/rspec/core/mocking/with_rspec.rb +6 -2
  69. data/lib/rspec/core/option_parser.rb +28 -7
  70. data/lib/rspec/core/project_initializer.rb +0 -1
  71. data/lib/rspec/core/rake_task.rb +49 -38
  72. data/lib/rspec/core/reporter.rb +2 -2
  73. data/lib/rspec/core/shared_example_group.rb +89 -41
  74. data/lib/rspec/core/subject.rb +6 -2
  75. data/lib/rspec/core/version.rb +1 -1
  76. data/lib/rspec/core/world.rb +2 -2
  77. data/spec/autotest/rspec_spec.rb +6 -1
  78. data/spec/command_line/order_spec.rb +67 -0
  79. data/spec/rspec/core/configuration_options_spec.rb +45 -38
  80. data/spec/rspec/core/configuration_spec.rb +219 -44
  81. data/spec/rspec/core/deprecations_spec.rb +9 -0
  82. data/spec/rspec/core/drb_command_line_spec.rb +1 -7
  83. data/spec/rspec/core/drb_options_spec.rb +1 -1
  84. data/spec/rspec/core/dsl_spec.rb +17 -9
  85. data/spec/rspec/core/example_group_spec.rb +51 -5
  86. data/spec/rspec/core/example_spec.rb +39 -7
  87. data/spec/rspec/core/filter_manager_spec.rb +20 -30
  88. data/spec/rspec/core/formatters/base_formatter_spec.rb +29 -1
  89. data/spec/rspec/core/formatters/base_text_formatter_spec.rb +6 -2
  90. data/spec/rspec/core/formatters/helpers_spec.rb +12 -0
  91. data/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html +462 -0
  92. data/spec/rspec/core/formatters/html_formatted-1.9.2-jruby.html +410 -0
  93. data/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html +462 -0
  94. data/spec/rspec/core/formatters/html_formatter_spec.rb +11 -3
  95. data/spec/rspec/core/formatters/json_formatter_spec.rb +110 -0
  96. data/spec/rspec/core/formatters/snippet_extractor_spec.rb +8 -0
  97. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-rbx.html +462 -0
  98. data/spec/rspec/core/formatters/text_mate_formatted-1.9.2-jruby.html +410 -0
  99. data/spec/rspec/core/formatters/text_mate_formatted-1.9.3-rbx.html +462 -0
  100. data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +11 -3
  101. data/spec/rspec/core/hooks_filtering_spec.rb +6 -6
  102. data/spec/rspec/core/metadata_spec.rb +29 -0
  103. data/spec/rspec/core/option_parser_spec.rb +42 -0
  104. data/spec/rspec/core/project_initializer_spec.rb +2 -2
  105. data/spec/rspec/core/rake_task_spec.rb +60 -17
  106. data/spec/rspec/core/reporter_spec.rb +17 -0
  107. data/spec/rspec/core/runner_spec.rb +1 -0
  108. data/spec/rspec/core/shared_example_group_spec.rb +17 -5
  109. data/spec/rspec/core/subject_spec.rb +11 -0
  110. data/spec/spec_helper.rb +32 -2
  111. data/spec/support/config_options_helper.rb +1 -10
  112. data/spec/support/helper_methods.rb +13 -0
  113. data/spec/support/isolated_directory.rb +10 -0
  114. data/spec/support/isolated_home_directory.rb +16 -0
  115. metadata +145 -148
  116. data/lib/rspec/core/extensions.rb +0 -4
@@ -6,13 +6,13 @@ Feature: fail fast
6
6
 
7
7
  Background:
8
8
  Given a file named "spec/spec_helper.rb" with:
9
- """
9
+ """ruby
10
10
  RSpec.configure {|c| c.fail_fast = true}
11
11
  """
12
12
 
13
13
  Scenario: fail_fast with no failures (runs all examples)
14
14
  Given a file named "spec/example_spec.rb" with:
15
- """
15
+ """ruby
16
16
  describe "something" do
17
17
  it "passes" do
18
18
  end
@@ -26,7 +26,7 @@ Feature: fail fast
26
26
 
27
27
  Scenario: fail_fast with first example failing (only runs the one example)
28
28
  Given a file named "spec/example_spec.rb" with:
29
- """
29
+ """ruby
30
30
  require "spec_helper"
31
31
  describe "something" do
32
32
  it "fails" do
@@ -42,7 +42,7 @@ Feature: fail fast
42
42
 
43
43
  Scenario: fail_fast with multiple files, second example failing (only runs the first two examples)
44
44
  Given a file named "spec/example_1_spec.rb" with:
45
- """
45
+ """ruby
46
46
  require "spec_helper"
47
47
  describe "something" do
48
48
  it "passes" do
@@ -60,7 +60,7 @@ Feature: fail fast
60
60
  end
61
61
  """
62
62
  And a file named "spec/example_2_spec.rb" with:
63
- """
63
+ """ruby
64
64
  require "spec_helper"
65
65
  describe "something" do
66
66
  it "passes" do
@@ -15,7 +15,7 @@ Feature: read command line configuration options from files
15
15
  --color
16
16
  """
17
17
  And a file named "spec/example_spec.rb" with:
18
- """
18
+ """ruby
19
19
  describe "color_enabled" do
20
20
  context "when set with RSpec.configure" do
21
21
  before do
@@ -39,7 +39,7 @@ Feature: read command line configuration options from files
39
39
  --format documentation
40
40
  """
41
41
  And a file named "spec/example_spec.rb" with:
42
- """
42
+ """ruby
43
43
  describe "formatter set in custom options file" do
44
44
  it "sets formatter" do
45
45
  RSpec.configuration.formatters.first.
@@ -60,7 +60,7 @@ Feature: read command line configuration options from files
60
60
  --color
61
61
  """
62
62
  And a file named "spec/example_spec.rb" with:
63
- """
63
+ """ruby
64
64
  describe "custom options file" do
65
65
  it "causes .rspec to be ignored" do
66
66
  RSpec.configuration.color_enabled.should be_false
@@ -76,7 +76,7 @@ Feature: read command line configuration options from files
76
76
  --format <%= true ? 'documentation' : 'progress' %>
77
77
  """
78
78
  And a file named "spec/example_spec.rb" with:
79
- """
79
+ """ruby
80
80
  describe "formatter" do
81
81
  it "is set to documentation" do
82
82
  RSpec.configuration.formatters.first.should be_an(RSpec::Core::Formatters::DocumentationFormatter)
@@ -17,7 +17,7 @@ Feature: basic structure (describe/it)
17
17
 
18
18
  Scenario: one group, one example
19
19
  Given a file named "sample_spec.rb" with:
20
- """
20
+ """ruby
21
21
  describe "something" do
22
22
  it "does something" do
23
23
  end
@@ -32,7 +32,7 @@ Feature: basic structure (describe/it)
32
32
 
33
33
  Scenario: nested example groups (using context)
34
34
  Given a file named "nested_example_groups_spec.rb" with:
35
- """
35
+ """ruby
36
36
  describe "something" do
37
37
  context "in one context" do
38
38
  it "does one thing" do
@@ -6,7 +6,7 @@ Feature: shared context
6
6
 
7
7
  Background:
8
8
  Given a file named "shared_stuff.rb" with:
9
- """
9
+ """ruby
10
10
  shared_context "shared stuff", :a => :b do
11
11
  before { @some_var = :some_value }
12
12
  def shared_method
@@ -21,7 +21,7 @@ Feature: shared context
21
21
 
22
22
  Scenario: declare shared context and include it with include_context
23
23
  Given a file named "shared_context_example.rb" with:
24
- """
24
+ """ruby
25
25
  require "./shared_stuff.rb"
26
26
 
27
27
  describe "group that includes a shared context using 'include_context'" do
@@ -49,7 +49,7 @@ Feature: shared context
49
49
 
50
50
  Scenario: declare shared context and include it with metadata
51
51
  Given a file named "shared_context_example.rb" with:
52
- """
52
+ """ruby
53
53
  require "./shared_stuff.rb"
54
54
 
55
55
  describe "group that includes a shared context using metadata", :a => :b do
@@ -6,10 +6,11 @@ Feature: shared examples
6
6
  needs to run.
7
7
 
8
8
  A shared group is included in another group using any of:
9
-
9
+
10
10
  include_examples "name" # include the examples in the current context
11
11
  it_behaves_like "name" # include the examples in a nested context
12
12
  it_should_behave_like "name" # include the examples in a nested context
13
+ matching metadata # include the examples in the current context
13
14
 
14
15
  WARNING: Files containing shared groups must be loaded before the files that
15
16
  use them. While there are conventions to handle this, RSpec does _not_ do
@@ -27,7 +28,7 @@ Feature: shared examples
27
28
  2. Put files containing shared examples in `spec/support/` and require files
28
29
  in that directory from `spec/spec_helper.rb`:
29
30
 
30
- Dir["./spec/support/**/*.rb"].each {|f| require f}
31
+ Dir["./spec/support/**/*.rb"].sort.each {|f| require f}
31
32
 
32
33
  This is included in the generated `spec/spec_helper.rb` file in
33
34
  `rspec-rails`
@@ -37,7 +38,7 @@ Feature: shared examples
37
38
 
38
39
  Scenario: shared examples group included in two groups in one file
39
40
  Given a file named "collection_spec.rb" with:
40
- """
41
+ """ruby
41
42
  require "set"
42
43
 
43
44
  shared_examples "a collection" do
@@ -99,7 +100,7 @@ Feature: shared examples
99
100
 
100
101
  Scenario: Providing context to a shared group using a block
101
102
  Given a file named "shared_example_group_spec.rb" with:
102
- """
103
+ """ruby
103
104
  require "set"
104
105
 
105
106
  shared_examples "a collection object" do
@@ -107,7 +108,7 @@ Feature: shared examples
107
108
  it "adds objects to the end of the collection" do
108
109
  collection << 1
109
110
  collection << 2
110
- collection.to_a.should eq([1,2])
111
+ expect(collection.to_a).to match_array([1, 2])
111
112
  end
112
113
  end
113
114
  end
@@ -141,7 +142,7 @@ Feature: shared examples
141
142
 
142
143
  Scenario: Passing parameters to a shared example group
143
144
  Given a file named "shared_example_group_params_spec.rb" with:
144
- """
145
+ """ruby
145
146
  shared_examples "a measurable object" do |measurement, measurement_methods|
146
147
  measurement_methods.each do |measurement_method|
147
148
  it "should return #{measurement} from ##{measurement_method}" do
@@ -177,7 +178,7 @@ Feature: shared examples
177
178
 
178
179
  Scenario: Aliasing "it_should_behave_like" to "it_has_behavior"
179
180
  Given a file named "shared_example_group_spec.rb" with:
180
- """
181
+ """ruby
181
182
  RSpec.configure do |c|
182
183
  c.alias_it_should_behave_like_to :it_has_behavior, 'has behavior:'
183
184
  end
@@ -202,3 +203,20 @@ Feature: shared examples
202
203
  has behavior: sortability
203
204
  responds to <=>
204
205
  """
206
+
207
+ Scenario: Sharing metadata automatically includes shared example groups
208
+ Given a file named "shared_example_metadata_spec.rb" with:
209
+ """ruby
210
+ shared_examples "shared stuff", :a => :b do
211
+ it 'runs wherever the metadata is shared' do
212
+ end
213
+ end
214
+
215
+ describe String, :a => :b do
216
+ end
217
+ """
218
+ When I run `rspec shared_example_metadata_spec.rb`
219
+ Then the output should contain:
220
+ """
221
+ 1 example, 0 failures
222
+ """
@@ -7,7 +7,7 @@ Feature: configure expectation framework
7
7
  * stdlib assertions
8
8
  * test/unit assertions in ruby 1.8
9
9
  * minitest assertions in ruby 1.9
10
- * rspec/expecations _and_ stlib assertions
10
+ * rspec/expectations _and_ stlib assertions
11
11
 
12
12
  Note that when you do not use rspec-expectations, you must explicitly
13
13
  provide a description to every example. You cannot rely on the generated
@@ -15,7 +15,7 @@ Feature: configure expectation framework
15
15
 
16
16
  Scenario: rspec-expectations can be used by default if nothing is configured
17
17
  Given a file named "example_spec.rb" with:
18
- """
18
+ """ruby
19
19
  RSpec::Matchers.define :be_a_multiple_of do |factor|
20
20
  match do |actual|
21
21
  actual % factor == 0
@@ -31,7 +31,7 @@ Feature: configure expectation framework
31
31
 
32
32
  Scenario: configure rspec-expectations (explicitly)
33
33
  Given a file named "example_spec.rb" with:
34
- """
34
+ """ruby
35
35
  RSpec.configure do |config|
36
36
  config.expect_with :rspec
37
37
  end
@@ -47,7 +47,7 @@ Feature: configure expectation framework
47
47
 
48
48
  Scenario: configure test/unit assertions (passing examples)
49
49
  Given a file named "example_spec.rb" with:
50
- """
50
+ """ruby
51
51
  RSpec.configure do |config|
52
52
  config.expect_with :stdlib
53
53
  end
@@ -65,7 +65,7 @@ Feature: configure expectation framework
65
65
 
66
66
  Scenario: configure test/unit assertions (failing examples)
67
67
  Given a file named "example_spec.rb" with:
68
- """
68
+ """ruby
69
69
  RSpec.configure do |config|
70
70
  config.expect_with :stdlib
71
71
  end
@@ -83,7 +83,7 @@ Feature: configure expectation framework
83
83
 
84
84
  Scenario: configure rspec/expecations AND test/unit assertions
85
85
  Given a file named "example_spec.rb" with:
86
- """
86
+ """ruby
87
87
  RSpec.configure do |config|
88
88
  config.expect_with :rspec, :stdlib
89
89
  end
@@ -8,7 +8,7 @@ Feature: exclusion filters
8
8
 
9
9
  Scenario: exclude an example
10
10
  Given a file named "spec/sample_spec.rb" with:
11
- """
11
+ """ruby
12
12
  RSpec.configure do |c|
13
13
  # declare an exclusion filter
14
14
  c.filter_run_excluding :broken => true
@@ -29,7 +29,7 @@ Feature: exclusion filters
29
29
 
30
30
  Scenario: exclude a group
31
31
  Given a file named "spec/sample_spec.rb" with:
32
- """
32
+ """ruby
33
33
  RSpec.configure do |c|
34
34
  c.filter_run_excluding :broken => true
35
35
  end
@@ -54,7 +54,7 @@ Feature: exclusion filters
54
54
 
55
55
  Scenario: exclude multiple groups
56
56
  Given a file named "spec/sample_spec.rb" with:
57
- """
57
+ """ruby
58
58
  RSpec.configure do |c|
59
59
  c.filter_run_excluding :broken => true
60
60
  end
@@ -88,7 +88,7 @@ Feature: exclusion filters
88
88
 
89
89
  Scenario: before/after(:all) hooks in excluded example group are not run
90
90
  Given a file named "spec/before_after_all_exclusion_filter_spec.rb" with:
91
- """
91
+ """ruby
92
92
  RSpec.configure do |c|
93
93
  c.filter_run_excluding :broken => true
94
94
  end
@@ -119,7 +119,7 @@ Feature: exclusion filters
119
119
 
120
120
  Scenario: Use symbols as metadata
121
121
  Given a file named "symbols_as_metadata_spec.rb" with:
122
- """
122
+ """ruby
123
123
  RSpec.configure do |c|
124
124
  c.treat_symbols_as_metadata_keys_with_true_values = true
125
125
  c.filter_run_excluding :broken
@@ -5,7 +5,7 @@ Feature: :if and :unless
5
5
 
6
6
  Scenario: implicit :if filter
7
7
  Given a file named "implicit_if_filter_spec.rb" with:
8
- """
8
+ """ruby
9
9
  describe ":if => true group", :if => true do
10
10
  it(":if => true group :if => true example", :if => true) { }
11
11
  it(":if => true group :if => false example", :if => false) { }
@@ -39,7 +39,7 @@ Feature: :if and :unless
39
39
 
40
40
  Scenario: implicit :unless filter
41
41
  Given a file named "implicit_unless_filter_spec.rb" with:
42
- """
42
+ """ruby
43
43
  describe ":unless => true group", :unless => true do
44
44
  it(":unless => true group :unless => true example", :unless => true) { }
45
45
  it(":unless => true group :unless => false example", :unless => false) { }
@@ -73,7 +73,7 @@ Feature: :if and :unless
73
73
 
74
74
  Scenario: combining implicit filter with explicit inclusion filter
75
75
  Given a file named "explicit_inclusion_filter_spec.rb" with:
76
- """
76
+ """ruby
77
77
  RSpec.configure do |c|
78
78
  c.filter_run :focus => true
79
79
  end
@@ -106,7 +106,7 @@ Feature: :if and :unless
106
106
 
107
107
  Scenario: combining implicit filter with explicit exclusion filter
108
108
  Given a file named "explicit_exclusion_filter_spec.rb" with:
109
- """
109
+ """ruby
110
110
  RSpec.configure do |c|
111
111
  c.filter_run_excluding :broken => true
112
112
  end
@@ -139,7 +139,7 @@ Feature: :if and :unless
139
139
 
140
140
  Scenario: override implicit :if and :unless exclusion filters
141
141
  Given a file named "override_implicit_filters_spec.rb" with:
142
- """
142
+ """ruby
143
143
  RSpec.configure do |c|
144
144
  c.filter_run_excluding :if => :exclude_me, :unless => :exclude_me_for_unless
145
145
  end
@@ -9,7 +9,7 @@ Feature: inclusion filters
9
9
 
10
10
  Background:
11
11
  Given a file named "spec/spec_helper.rb" with:
12
- """
12
+ """ruby
13
13
  RSpec.configure do |c|
14
14
  c.filter_run_including :focus => true
15
15
  end
@@ -17,7 +17,7 @@ Feature: inclusion filters
17
17
 
18
18
  Scenario: focus on an example
19
19
  Given a file named "spec/sample_spec.rb" with:
20
- """
20
+ """ruby
21
21
  require "spec_helper"
22
22
 
23
23
  describe "something" do
@@ -34,7 +34,7 @@ Feature: inclusion filters
34
34
 
35
35
  Scenario: focus on a group
36
36
  Given a file named "spec/sample_spec.rb" with:
37
- """
37
+ """ruby
38
38
  require "spec_helper"
39
39
 
40
40
  describe "group 1", :focus => true do
@@ -57,7 +57,7 @@ Feature: inclusion filters
57
57
 
58
58
  Scenario: before/after(:all) hooks in unmatched example group are not run
59
59
  Given a file named "spec/before_after_all_inclusion_filter_spec.rb" with:
60
- """
60
+ """ruby
61
61
  require "spec_helper"
62
62
 
63
63
  describe "group 1", :focus => true do
@@ -86,7 +86,7 @@ Feature: inclusion filters
86
86
 
87
87
  Scenario: Use symbols as metadata
88
88
  Given a file named "symbols_as_metadata_spec.rb" with:
89
- """
89
+ """ruby
90
90
  RSpec.configure do |c|
91
91
  c.treat_symbols_as_metadata_keys_with_true_values = true
92
92
  c.filter_run :current_example
@@ -1,12 +1,12 @@
1
1
  Feature: run all when everything filtered
2
2
 
3
- Use the run_all_when_everything_filtered configuration option to do just
3
+ Use the `run_all_when_everything_filtered` configuration option to do just
4
4
  that. This works well when paired with an inclusion filter like ":focus =>
5
5
  true", as it will run all the examples when none match the inclusion filter.
6
6
 
7
7
  Background:
8
8
  Given a file named "spec/spec_helper.rb" with:
9
- """
9
+ """ruby
10
10
  RSpec.configure do |c|
11
11
  c.filter_run :focus => true
12
12
  c.run_all_when_everything_filtered = true
@@ -15,7 +15,7 @@ Feature: run all when everything filtered
15
15
 
16
16
  Scenario: no examples match filter (runs all examples)
17
17
  Given a file named "spec/sample_spec.rb" with:
18
- """
18
+ """ruby
19
19
  require "spec_helper"
20
20
 
21
21
  describe "group 1" do
@@ -11,7 +11,7 @@ Feature: custom formatters
11
11
 
12
12
  Scenario: custom formatter
13
13
  Given a file named "custom_formatter.rb" with:
14
- """
14
+ """ruby
15
15
  require "rspec/core/formatters/base_text_formatter"
16
16
 
17
17
  class CustomFormatter < RSpec::Core::Formatters::BaseTextFormatter
@@ -25,7 +25,7 @@ Feature: custom formatters
25
25
  end
26
26
  """
27
27
  And a file named "example_spec.rb" with:
28
- """
28
+ """ruby
29
29
  describe "my group" do
30
30
  specify "my example" do
31
31
  end
@@ -0,0 +1,30 @@
1
+ Feature: JSON formatter
2
+
3
+ Scenario: Formatting example names for retry
4
+ Given a file named "various_spec.rb" with:
5
+ """ruby
6
+ describe "Various" do
7
+ it "fails" do
8
+ "fail".should eq("succeed")
9
+ end
10
+
11
+ it "succeeds" do
12
+ "succeed".should eq("succeed")
13
+ end
14
+
15
+ it "pends"
16
+ end
17
+ """
18
+ When I run `rspec various_spec.rb --format j`
19
+ Then the output should contain all of these:
20
+ |"summary_line":"3 examples, 1 failure, 1 pending"|
21
+ |"examples":[ |
22
+ |"description":"fails" |
23
+ |"full_description":"Various fails" |
24
+ |"status":"failed" |
25
+ |"file_path":"./various_spec.rb" |
26
+ |"line_number":2 |
27
+ |"exception":{ |
28
+ |"class":"RSpec::Expectations::ExpectationNotMetError"|
29
+
30
+ And the exit status should be 1