rspec 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. data/History.rdoc +31 -1
  2. data/Manifest.txt +14 -12
  3. data/Rakefile +1 -1
  4. data/Upgrade.rdoc +43 -3
  5. data/examples/failing/failing_implicit_docstrings_example.rb +5 -5
  6. data/examples/passing/implicit_docstrings_example.rb +3 -3
  7. data/features/before_and_after_blocks/before_and_after_blocks.feature +20 -21
  8. data/features/example_groups/example_group_with_should_methods.feature +20 -8
  9. data/features/example_groups/implicit_docstrings.feature +36 -20
  10. data/features/example_groups/nested_groups.feature +25 -10
  11. data/features/extensions/custom_example_group.feature +19 -0
  12. data/features/formatters/custom_formatter.feature +30 -0
  13. data/features/heckle/heckle.feature +7 -7
  14. data/features/interop/examples_and_tests_together.feature +63 -14
  15. data/features/interop/rspec_output.feature +25 -0
  16. data/features/interop/test_but_not_test_unit.feature +19 -7
  17. data/features/interop/test_case_with_should_methods.feature +37 -8
  18. data/features/matchers/{create_matcher.feature → define_matcher.feature} +54 -30
  19. data/features/matchers/{create_matcher_outside_rspec.feature → define_matcher_outside_rspec.feature} +7 -7
  20. data/features/mock_framework_integration/use_flexmock.feature +3 -3
  21. data/features/mock_framework_integration/use_mocha.feature +3 -3
  22. data/features/mock_framework_integration/use_rr.feature +3 -3
  23. data/features/mocks/mix_stubs_and_mocks.feature +4 -4
  24. data/features/pending/pending_examples.feature +18 -18
  25. data/features/runner/specify_line_number.feature +32 -0
  26. data/features/step_definitions/running_rspec_steps.rb +41 -0
  27. data/features/subject/explicit_subject.feature +4 -4
  28. data/features/subject/implicit_subject.feature +4 -4
  29. data/features/support/env.rb +64 -11
  30. data/features/support/matchers/smart_match.rb +10 -35
  31. data/lib/spec.rb +1 -0
  32. data/lib/spec/deprecation.rb +40 -0
  33. data/lib/spec/dsl/main.rb +10 -5
  34. data/lib/spec/example.rb +1 -27
  35. data/lib/spec/example/args_and_options.rb +27 -0
  36. data/lib/spec/example/before_and_after_hooks.rb +30 -21
  37. data/lib/spec/example/errors.rb +8 -18
  38. data/lib/spec/example/example_group_factory.rb +0 -4
  39. data/lib/spec/example/example_group_methods.rb +27 -41
  40. data/lib/spec/example/example_group_proxy.rb +12 -22
  41. data/lib/spec/example/example_methods.rb +8 -18
  42. data/lib/spec/example/example_proxy.rb +4 -4
  43. data/lib/spec/example/pending.rb +3 -4
  44. data/lib/spec/example/predicate_matchers.rb +1 -1
  45. data/lib/spec/example/subject.rb +2 -0
  46. data/lib/spec/expectations.rb +1 -26
  47. data/lib/spec/expectations/extensions.rb +1 -1
  48. data/lib/spec/expectations/extensions/kernel.rb +52 -0
  49. data/lib/spec/expectations/handler.rb +21 -10
  50. data/lib/spec/matchers/be.rb +3 -3
  51. data/lib/spec/matchers/be_close.rb +17 -21
  52. data/lib/spec/matchers/be_instance_of.rb +7 -26
  53. data/lib/spec/matchers/be_kind_of.rb +7 -26
  54. data/lib/spec/matchers/dsl.rb +9 -4
  55. data/lib/spec/matchers/eql.rb +24 -25
  56. data/lib/spec/matchers/equal.rb +25 -25
  57. data/lib/spec/matchers/exist.rb +5 -21
  58. data/lib/spec/matchers/include.rb +22 -44
  59. data/lib/spec/matchers/match.rb +5 -25
  60. data/lib/spec/matchers/match_array.rb +8 -4
  61. data/lib/spec/matchers/matcher.rb +13 -2
  62. data/lib/spec/matchers/pretty.rb +1 -0
  63. data/lib/spec/matchers/simple_matcher.rb +2 -2
  64. data/lib/spec/mocks/mock.rb +10 -10
  65. data/lib/spec/mocks/spec_methods.rb +1 -1
  66. data/lib/spec/runner/configuration.rb +53 -42
  67. data/lib/spec/{expectations → runner}/differs/default.rb +0 -0
  68. data/lib/spec/{expectations → runner}/differs/load-diff-lcs.rb +0 -0
  69. data/lib/spec/runner/drb_command_line.rb +1 -1
  70. data/lib/spec/runner/example_group_runner.rb +0 -12
  71. data/lib/spec/runner/formatter/base_formatter.rb +77 -30
  72. data/lib/spec/runner/formatter/base_text_formatter.rb +19 -24
  73. data/lib/spec/runner/formatter/failing_example_groups_formatter.rb +1 -1
  74. data/lib/spec/runner/formatter/html_formatter.rb +4 -6
  75. data/lib/spec/runner/formatter/nested_text_formatter.rb +2 -2
  76. data/lib/spec/runner/formatter/no_op_method_missing.rb +21 -0
  77. data/lib/spec/runner/formatter/profile_formatter.rb +0 -4
  78. data/lib/spec/runner/formatter/progress_bar_formatter.rb +4 -5
  79. data/lib/spec/runner/formatter/silent_formatter.rb +10 -0
  80. data/lib/spec/runner/formatter/specdoc_formatter.rb +2 -2
  81. data/lib/spec/runner/option_parser.rb +14 -7
  82. data/lib/spec/runner/options.rb +17 -7
  83. data/lib/spec/runner/reporter.rb +69 -64
  84. data/lib/spec/version.rb +1 -1
  85. data/spec/spec/dsl/main_spec.rb +7 -0
  86. data/spec/spec/example/example_group_methods_spec.rb +16 -32
  87. data/spec/spec/example/example_group_proxy_spec.rb +25 -5
  88. data/spec/spec/example/example_group_spec.rb +2 -2
  89. data/spec/spec/example/example_methods_spec.rb +19 -24
  90. data/spec/spec/example/example_proxy_spec.rb +11 -1
  91. data/spec/spec/example/pending_module_spec.rb +2 -108
  92. data/spec/spec/example/predicate_matcher_spec.rb +23 -3
  93. data/spec/spec/expectations/extensions/object_spec.rb +9 -9
  94. data/spec/spec/expectations/fail_with_spec.rb +13 -13
  95. data/spec/spec/expectations/handler_spec.rb +44 -15
  96. data/spec/spec/matchers/be_close_spec.rb +9 -0
  97. data/spec/spec/matchers/be_instance_of_spec.rb +6 -4
  98. data/spec/spec/matchers/be_kind_of_spec.rb +5 -3
  99. data/spec/spec/matchers/be_spec.rb +1 -5
  100. data/spec/spec/matchers/compatibility_spec.rb +1 -1
  101. data/spec/spec/matchers/dsl_spec.rb +10 -1
  102. data/spec/spec/matchers/eql_spec.rb +8 -4
  103. data/spec/spec/matchers/equal_spec.rb +8 -4
  104. data/spec/spec/matchers/exist_spec.rb +1 -1
  105. data/spec/spec/matchers/include_spec.rb +1 -1
  106. data/spec/spec/matchers/match_array_spec.rb +26 -1
  107. data/spec/spec/matchers/match_spec.rb +2 -2
  108. data/spec/spec/matchers/matcher_methods_spec.rb +0 -3
  109. data/spec/spec/matchers/matcher_spec.rb +53 -0
  110. data/spec/spec/matchers/operator_matcher_spec.rb +1 -1
  111. data/spec/spec/mocks/mock_spec.rb +6 -0
  112. data/spec/spec/runner/configuration_spec.rb +11 -1
  113. data/spec/spec/runner/drb_command_line_spec.rb +13 -1
  114. data/spec/spec/runner/example_group_runner_spec.rb +0 -7
  115. data/spec/spec/runner/formatter/base_formatter_spec.rb +19 -12
  116. data/spec/spec/runner/formatter/base_text_formatter_spec.rb +2 -2
  117. data/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +4 -4
  118. data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +2 -2
  119. data/spec/spec/runner/formatter/html_formatted-1.8.6.html +31 -34
  120. data/spec/spec/runner/formatter/html_formatter_spec.rb +20 -0
  121. data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +20 -20
  122. data/spec/spec/runner/formatter/profile_formatter_spec.rb +22 -3
  123. data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +24 -3
  124. data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +6 -6
  125. data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +25 -28
  126. data/spec/spec/runner/formatter/text_mate_formatter_spec.rb +2 -2
  127. data/spec/spec/runner/option_parser_spec.rb +108 -40
  128. data/spec/spec/runner/reporter_spec.rb +16 -17
  129. data/spec/spec_helper.rb +4 -1
  130. metadata +20 -18
  131. data/features/example_groups/output.feature +0 -20
  132. data/features/step_definitions/running_rspec.rb +0 -69
  133. data/lib/spec/expectations/extensions/object.rb +0 -63
  134. data/resources/spec/example_group_with_should_methods.rb +0 -12
  135. data/resources/spec/simple_spec.rb +0 -8
  136. data/resources/test/spec_and_test_together.rb +0 -56
  137. data/resources/test/spec_including_test_but_not_unit.rb +0 -11
  138. data/resources/test/test_case_with_should_methods.rb +0 -29
@@ -1,3 +1,33 @@
1
+ === Version 1.2.3
2
+
3
+ * deprecations
4
+
5
+ * BaseFormatter#add_example_group (use #example_group_started instead)
6
+ * ExampleGroupProxy#backtrace (use #location instead)
7
+ * ExampleProxy#backtrace (use #location instead)
8
+ * BaseFormatter#example_pending now expects two arguments. The third
9
+ argument is deprecated.
10
+ * ExampleGroupProxy#filtered_description. This was only used in one place
11
+ internally, and was a confusing solution to the problem. If you've got a
12
+ custom formatter that uses it, you can just use
13
+ ExampleGroupProxy#description and modify it directly.
14
+ * predicate_matchers (use the new Matcher DSL instead)
15
+ * Spec::Matchers.create (use Spec::Matchers.define instead)
16
+
17
+ * enhancements
18
+
19
+ * support for specifying single examples with colon syntax. Closes #712.
20
+ (Ben Mabey)
21
+ * you can now say "spec some_spec.rb:12" in addition to "spec some_spec.rb
22
+ --line 12"
23
+ * run specs locally with --drb if no drb server is running. Closes #780.
24
+ * still prints "No server running" to stderr
25
+
26
+ * bug fixes
27
+
28
+ * support expectations on DelegateClass (Clifford T. Matthews). Closes #48.
29
+ * Fixed match_array blows up if elements can't be sorted (Jeff Dean). Closes #779.
30
+
1
31
  === Version 1.2.2 / 2009-03-22
2
32
 
3
33
  Bug-fix release (fixes regression introduced in 1.2.1)
@@ -14,7 +44,7 @@ rspec-1.2.0.
14
44
 
15
45
  See Upgrade.rdoc for information about upgrading to rspec-1.2.1
16
46
 
17
- * enhancments
47
+ * enhancements
18
48
 
19
49
  * matchers, including the new DSL, easily added to your test/unit tests
20
50
  * added support for 0 to n args in matcher DSL
@@ -60,19 +60,22 @@ features/before_and_after_blocks/before_and_after_blocks.feature
60
60
  features/example_groups/example_group_with_should_methods.feature
61
61
  features/example_groups/implicit_docstrings.feature
62
62
  features/example_groups/nested_groups.feature
63
- features/example_groups/output.feature
63
+ features/extensions/custom_example_group.feature
64
+ features/formatters/custom_formatter.feature
64
65
  features/heckle/heckle.feature
65
66
  features/interop/examples_and_tests_together.feature
67
+ features/interop/rspec_output.feature
66
68
  features/interop/test_but_not_test_unit.feature
67
69
  features/interop/test_case_with_should_methods.feature
68
- features/matchers/create_matcher.feature
69
- features/matchers/create_matcher_outside_rspec.feature
70
+ features/matchers/define_matcher.feature
71
+ features/matchers/define_matcher_outside_rspec.feature
70
72
  features/mock_framework_integration/use_flexmock.feature
71
73
  features/mock_framework_integration/use_mocha.feature
72
74
  features/mock_framework_integration/use_rr.feature
73
75
  features/mocks/mix_stubs_and_mocks.feature
74
76
  features/pending/pending_examples.feature
75
- features/step_definitions/running_rspec.rb
77
+ features/runner/specify_line_number.feature
78
+ features/step_definitions/running_rspec_steps.rb
76
79
  features/subject/explicit_subject.feature
77
80
  features/subject/implicit_subject.feature
78
81
  features/support/env.rb
@@ -86,9 +89,11 @@ lib/spec/adapters/mock_frameworks/mocha.rb
86
89
  lib/spec/adapters/mock_frameworks/rr.rb
87
90
  lib/spec/adapters/mock_frameworks/rspec.rb
88
91
  lib/spec/autorun.rb
92
+ lib/spec/deprecation.rb
89
93
  lib/spec/dsl.rb
90
94
  lib/spec/dsl/main.rb
91
95
  lib/spec/example.rb
96
+ lib/spec/example/args_and_options.rb
92
97
  lib/spec/example/before_and_after_hooks.rb
93
98
  lib/spec/example/errors.rb
94
99
  lib/spec/example/example_group.rb
@@ -105,11 +110,9 @@ lib/spec/example/predicate_matchers.rb
105
110
  lib/spec/example/shared_example_group.rb
106
111
  lib/spec/example/subject.rb
107
112
  lib/spec/expectations.rb
108
- lib/spec/expectations/differs/default.rb
109
- lib/spec/expectations/differs/load-diff-lcs.rb
110
113
  lib/spec/expectations/errors.rb
111
114
  lib/spec/expectations/extensions.rb
112
- lib/spec/expectations/extensions/object.rb
115
+ lib/spec/expectations/extensions/kernel.rb
113
116
  lib/spec/expectations/handler.rb
114
117
  lib/spec/interop/test.rb
115
118
  lib/spec/interop/test/unit/autorunner.rb
@@ -169,6 +172,8 @@ lib/spec/runner/backtrace_tweaker.rb
169
172
  lib/spec/runner/class_and_arguments_parser.rb
170
173
  lib/spec/runner/command_line.rb
171
174
  lib/spec/runner/configuration.rb
175
+ lib/spec/runner/differs/default.rb
176
+ lib/spec/runner/differs/load-diff-lcs.rb
172
177
  lib/spec/runner/drb_command_line.rb
173
178
  lib/spec/runner/example_group_runner.rb
174
179
  lib/spec/runner/extensions/kernel.rb
@@ -178,8 +183,10 @@ lib/spec/runner/formatter/failing_example_groups_formatter.rb
178
183
  lib/spec/runner/formatter/failing_examples_formatter.rb
179
184
  lib/spec/runner/formatter/html_formatter.rb
180
185
  lib/spec/runner/formatter/nested_text_formatter.rb
186
+ lib/spec/runner/formatter/no_op_method_missing.rb
181
187
  lib/spec/runner/formatter/profile_formatter.rb
182
188
  lib/spec/runner/formatter/progress_bar_formatter.rb
189
+ lib/spec/runner/formatter/silent_formatter.rb
183
190
  lib/spec/runner/formatter/snippet_extractor.rb
184
191
  lib/spec/runner/formatter/specdoc_formatter.rb
185
192
  lib/spec/runner/formatter/text_mate_formatter.rb
@@ -196,11 +203,6 @@ resources/rake/examples.rake
196
203
  resources/rake/examples_with_rcov.rake
197
204
  resources/rake/failing_examples_with_html.rake
198
205
  resources/rake/verify_rcov.rake
199
- resources/spec/example_group_with_should_methods.rb
200
- resources/spec/simple_spec.rb
201
- resources/test/spec_and_test_together.rb
202
- resources/test/spec_including_test_but_not_unit.rb
203
- resources/test/test_case_with_should_methods.rb
204
206
  spec/README.jruby
205
207
  spec/autotest/autotest_helper.rb
206
208
  spec/autotest/autotest_matchers.rb
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ Hoe.new('rspec', Spec::VERSION::STRING) do |p|
13
13
  p.description = "Behaviour Driven Development for Ruby."
14
14
  p.rubyforge_name = 'rspec'
15
15
  p.developer('RSpec Development Team', 'rspec-devel@rubyforge.org')
16
- p.extra_dev_deps = [["cucumber",">= 0.1.13"]]
16
+ p.extra_dev_deps = [["cucumber",">= 0.2.2"]]
17
17
  p.remote_rdoc_dir = "rspec/#{Spec::VERSION::STRING}"
18
18
  p.rspec_options = ['--options', 'spec/spec.opts']
19
19
  p.history_file = 'History.rdoc'
@@ -1,4 +1,44 @@
1
- = Upgrade to rspec-1.2.1
1
+ = Upgrade to rspec-1.2.3
2
+
3
+ == What's Changed
4
+
5
+ === Matcher DSL
6
+
7
+ Use Spec::Matchers.define instead of Spec::Matchers.create (which is now
8
+ deprecated).
9
+
10
+ === Explicit Predicate Matchers are deprecated
11
+
12
+ With the addition of the new Matcher DSL the old, confusing, and
13
+ almost-nobody-uses-it explicit predicate matcher functionality's days are now
14
+ numbered.
15
+
16
+ If you're not familiar with this feature, don't worry about it. If you have anything
17
+ that looks like this:
18
+
19
+ predicate_matchers[:swim] = :can_swim?
20
+
21
+ Or this
22
+
23
+ config.predicate_matchers[:swim] = :can_swim?
24
+
25
+ Change it to this:
26
+
27
+ Spec::Matchers.define :swim do
28
+ match do |potential_swimmer|
29
+ potential_swimmer.can_swim?
30
+ end
31
+ end
32
+
33
+ == Custom Formatters
34
+
35
+ If you have an custom formatter, the <tt>add_example_group</tt> method has
36
+ been changed to <tt>example_group_started</tt>, and kept as an alias so your
37
+ formatters will still work. Though not yet, <tt>add_example_group</tt> will be
38
+ deprecated in a future minor release, and removed in a future major release,
39
+ so we recommend you make this change now.
40
+
41
+ = Upgrade to rspec-1.2.2
2
42
 
3
43
  == What's Changed
4
44
 
@@ -99,7 +139,7 @@ We'll still support the simple_matcher method, so never fear if you're using
99
139
  that, but we recommend that you start developing your new matchers with this
100
140
  new syntax.
101
141
 
102
- Spec::Matchers.create do :be_a_multiple_of |smaller|
142
+ Spec::Matchers.create :be_a_multiple_of do |smaller|
103
143
  match do |bigger|
104
144
  bigger % smaller == 0
105
145
  end
@@ -107,4 +147,4 @@ new syntax.
107
147
 
108
148
  9.should be_a_multiple_of(3)
109
149
 
110
- See <tt>features/matchers/create_matcher.feature</tt> for more examples
150
+ See <tt>features/matchers/define_matcher.feature</tt> for more examples
@@ -3,17 +3,17 @@ require File.dirname(__FILE__) + '/spec_helper'
3
3
  # Run spec w/ -fs to see the output of this file
4
4
 
5
5
  describe "Failing examples with no descriptions" do
6
-
6
+
7
7
  # description is auto-generated as "should equal(5)" based on the last #should
8
8
  it do
9
9
  3.should equal(2)
10
10
  5.should equal(5)
11
11
  end
12
-
12
+
13
13
  it { 3.should be > 5 }
14
-
14
+
15
15
  it { ["a"].should include("b") }
16
-
16
+
17
17
  it { [1,2,3].should_not respond_to(:size) }
18
-
18
+
19
19
  end
@@ -5,11 +5,11 @@ require File.dirname(__FILE__) + '/spec_helper'
5
5
  describe "Examples with no docstrings generate their own:" do
6
6
 
7
7
  specify { 3.should be < 5 }
8
-
8
+
9
9
  specify { ["a"].should include("a") }
10
-
10
+
11
11
  specify { [1,2,3].should respond_to(:size) }
12
-
12
+
13
13
  end
14
14
 
15
15
  describe 1 do
@@ -3,10 +3,10 @@ Feature: before and after blocks
3
3
  As a developer using RSpec
4
4
  I want to execute arbitrary code before and after each example
5
5
  So that I can control the environment in which it is run
6
-
6
+
7
7
  This is supported by the before and after methods which each take a symbol
8
8
  indicating the scope, and a block of code to execute.
9
-
9
+
10
10
  before(:each) blocks are run before each example
11
11
  before(:all) blocks are run once before all of the examples in a group
12
12
  before(:suite) blocks are run once before the entire suite
@@ -22,14 +22,14 @@ Feature: before and after blocks
22
22
  after each
23
23
  after all
24
24
  after suite
25
-
25
+
26
26
  Before and after blocks can be defined in the example groups to which they
27
27
  apply or in a configuration. When defined in a configuration, they can be
28
28
  applied to all groups or subsets of all groups defined by example group
29
29
  types.
30
-
30
+
31
31
  Scenario: define before(:each) block in example group
32
- Given the following spec:
32
+ Given a file named "before_each_in_example_group_spec.rb" with:
33
33
  """
34
34
  class Thing
35
35
  def widgets
@@ -41,27 +41,27 @@ Feature: before and after blocks
41
41
  before(:each) do
42
42
  @thing = Thing.new
43
43
  end
44
-
44
+
45
45
  context "initialized in before(:each)" do
46
46
  it "has 0 widgets" do
47
47
  @thing.should have(0).widgets
48
48
  end
49
-
49
+
50
50
  it "can get accept new widgets" do
51
51
  @thing.widgets << Object.new
52
52
  end
53
-
53
+
54
54
  it "does not share state across examples" do
55
55
  @thing.should have(0).widgets
56
56
  end
57
57
  end
58
58
  end
59
59
  """
60
- When I run it with the spec command
60
+ When I run "spec before_each_in_example_group_spec.rb"
61
61
  Then the stdout should match "3 examples, 0 failures"
62
-
62
+
63
63
  Scenario: define before(:all) block in example group
64
- Given the following spec:
64
+ Given a file named "before_all_in_example_group_spec.rb" with:
65
65
  """
66
66
  class Thing
67
67
  def widgets
@@ -73,27 +73,27 @@ Feature: before and after blocks
73
73
  before(:all) do
74
74
  @thing = Thing.new
75
75
  end
76
-
76
+
77
77
  context "initialized in before(:all)" do
78
78
  it "has 0 widgets" do
79
79
  @thing.should have(0).widgets
80
80
  end
81
-
81
+
82
82
  it "can get accept new widgets" do
83
83
  @thing.widgets << Object.new
84
84
  end
85
-
85
+
86
86
  it "shares state across examples" do
87
87
  @thing.should have(1).widgets
88
88
  end
89
89
  end
90
90
  end
91
91
  """
92
- When I run it with the spec command
92
+ When I run "spec before_all_in_example_group_spec.rb"
93
93
  Then the stdout should match "3 examples, 0 failures"
94
-
94
+
95
95
  Scenario: define before and after blocks in configuration
96
- Given the following spec:
96
+ Given a file named "befores_in_configuration_spec.rb" with:
97
97
  """
98
98
  Spec::Runner.configure do |config|
99
99
  config.before(:suite) do
@@ -125,11 +125,11 @@ Feature: before and after blocks
125
125
  end
126
126
  end
127
127
  """
128
- When I run it with the spec command
128
+ When I run "spec befores_in_configuration_spec.rb"
129
129
  Then the stdout should match "3 examples, 0 failures"
130
130
 
131
131
  Scenario: before/after blocks are run in order
132
- Given the following spec:
132
+ Given a file named "ensure_block_order_spec.rb" with:
133
133
  """
134
134
  Spec::Runner.configure do |config|
135
135
  config.before(:suite) do
@@ -162,7 +162,6 @@ Feature: before and after blocks
162
162
  end
163
163
  end
164
164
  """
165
-
166
- When I run it with the spec command
165
+ When I run "spec ensure_block_order_spec.rb"
167
166
  Then the stdout should match /before suite\nbefore all\nbefore each\nafter each\n\.after all\n.*after suite/m
168
167
 
@@ -4,14 +4,26 @@ Feature: Spec::ExampleGroup with should methods
4
4
  I want to use should_* methods in an ExampleGroup
5
5
  So that I use RSpec with classes and methods that look more like RSpec examples
6
6
 
7
- Scenario: Run with ruby
8
- Given the file ../../resources/spec/example_group_with_should_methods.rb
9
- When I run it with the ruby interpreter
10
- Then the exit code should be 256
11
- And the stdout should match "2 examples, 1 failure"
7
+ Scenario Outline: Example Group class with should methods
8
+ Given a file named "example_group_with_should_methods.rb" with:
9
+ """
10
+ require 'spec/autorun'
12
11
 
13
- Scenario: Run with spec
14
- Given the file ../../resources/spec/example_group_with_should_methods.rb
15
- When I run it with the spec command
12
+ class MySpec < Spec::ExampleGroup
13
+ def should_pass_with_should
14
+ 1.should == 1
15
+ end
16
+
17
+ def should_fail_with_should
18
+ 1.should == 2
19
+ end
20
+ end
21
+ """
22
+ When I run "<Command> example_group_with_should_methods.rb"
16
23
  Then the exit code should be 256
17
24
  And the stdout should match "2 examples, 1 failure"
25
+
26
+ Scenarios: Run with ruby and spec
27
+ | Command |
28
+ | ruby |
29
+ | spec |
@@ -4,38 +4,54 @@ Feature: implicit docstrings
4
4
  I want examples to generate their own names
5
5
  So that I can reduce duplication between example names and example code
6
6
 
7
- Scenario: run passing examples with ruby
8
- Given the file ../../examples/passing/implicit_docstrings_example.rb
7
+ Scenario Outline: run passing examples
8
+ Given a file named "implicit_docstrings_example.rb" with:
9
+ """
10
+ require 'spec/autorun'
11
+ describe "Examples with no docstrings generate their own:" do
9
12
 
10
- When I run it with the ruby interpreter -fs
13
+ specify { 3.should be < 5 }
11
14
 
12
- And the stdout should match /should be < 5/
15
+ specify { ["a"].should include("a") }
16
+
17
+ specify { [1,2,3].should respond_to(:size) }
18
+
19
+ end
20
+ """
21
+
22
+ When I run "<Command> implicit_docstrings_example.rb -fs"
23
+
24
+ Then the stdout should match /should be < 5/
13
25
  And the stdout should match /should include "a"/
14
26
  And the stdout should match /should respond to #size/
15
27
 
16
- Scenario: run failing examples with ruby
17
- Given the file ../../examples/failing/failing_implicit_docstrings_example.rb
28
+ Scenarios: Run with ruby and spec
29
+ | Command |
30
+ | ruby |
31
+ | spec |
18
32
 
19
- When I run it with the ruby interpreter -fs
33
+ Scenario Outline: run failing examples
34
+ Given a file named "failing_implicit_docstrings_example.rb" with:
35
+ """
36
+ require 'spec/autorun'
37
+ describe "Failing examples with no descriptions" do
20
38
 
21
- Then the stdout should match /should equal 2/
22
- And the stdout should match /should be > 5/
23
- And the stdout should match /should include "b"/
24
- And the stdout should match /should not respond to #size/
39
+ # description is auto-generated as "should equal(5)" based on the last #should
40
+ it do
41
+ 3.should equal(2)
42
+ 5.should equal(5)
43
+ end
25
44
 
26
- Scenario: run passing examples with spec
27
- Given the file ../../examples/passing/implicit_docstrings_example.rb
45
+ it { 3.should be > 5 }
28
46
 
29
- When I run it with the spec command -fs
47
+ it { ["a"].should include("b") }
30
48
 
31
- And the stdout should match /should be < 5/
32
- And the stdout should match /should include "a"/
33
- And the stdout should match /should respond to #size/
49
+ it { [1,2,3].should_not respond_to(:size) }
34
50
 
35
- Scenario: run failing examples with spec
36
- Given the file ../../examples/failing/failing_implicit_docstrings_example.rb
51
+ end
52
+ """
37
53
 
38
- When I run it with the spec command -fs
54
+ When I run "<Command> failing_implicit_docstrings_example.rb -fs"
39
55
 
40
56
  Then the stdout should match /should equal 2/
41
57
  And the stdout should match /should be > 5/