rspec 1.1.12 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +2 -1
- data/.document +7 -0
- data/History.txt +58 -0
- data/License.txt +1 -1
- data/Manifest.txt +45 -82
- data/README.txt +3 -6
- data/Rakefile +33 -13
- data/Ruby1.9.markdown +32 -0
- data/TODO.txt +10 -4
- data/Upgrade.markdown +63 -0
- data/bin/spec +1 -1
- data/cucumber.yml +3 -0
- data/examples/failing/{failing_autogenerated_docstrings_example.rb → failing_implicit_docstrings_example.rb} +0 -0
- data/examples/failing/pending_example.rb +9 -0
- data/examples/failing/spec_helper.rb +1 -1
- data/examples/passing/{custom_expectation_matchers.rb → custom_matchers.rb} +0 -0
- data/examples/passing/filtered_formatter.rb +18 -0
- data/examples/passing/filtered_formatter_example.rb +31 -0
- data/examples/passing/implicit_docstrings_example.rb +18 -0
- data/examples/passing/spec_helper.rb +1 -1
- data/examples/ruby1.9.compatibility/access_to_constants_spec.rb +17 -18
- data/features/before_and_after_blocks/before_and_after_blocks.feature +4 -4
- data/features/example_groups/example_group_with_should_methods.feature +1 -1
- data/features/example_groups/{autogenerated_docstrings.feature → implicit_docstrings.feature} +7 -9
- data/features/example_groups/nested_groups.feature +1 -1
- data/features/heckle/heckle.feature +56 -0
- data/features/interop/examples_and_tests_together.feature +1 -1
- data/features/interop/test_but_not_test_unit.feature +1 -1
- data/features/interop/test_case_with_should_methods.feature +1 -1
- data/features/matchers/create_matcher.feature +115 -0
- data/features/mock_framework_integration/use_flexmock.feature +22 -4
- data/features/mock_framework_integration/use_mocha.feature +27 -0
- data/features/mock_framework_integration/use_rr.feature +27 -0
- data/features/mocks/mix_stubs_and_mocks.feature +22 -0
- data/features/pending/pending_examples.feature +81 -0
- data/features/step_definitions/running_rspec.rb +5 -3
- data/features/support/env.rb +1 -1
- data/features/support/matchers/smart_match.rb +2 -2
- data/lib/autotest/rspec.rb +1 -1
- data/lib/spec.rb +1 -1
- data/lib/{adapters → spec/adapters}/mock_frameworks/flexmock.rb +0 -0
- data/lib/{adapters → spec/adapters}/mock_frameworks/mocha.rb +0 -0
- data/lib/{adapters → spec/adapters}/mock_frameworks/rr.rb +0 -0
- data/lib/{adapters → spec/adapters}/mock_frameworks/rspec.rb +0 -1
- data/lib/spec/autorun.rb +3 -0
- data/lib/spec/dsl.rb +3 -1
- data/lib/spec/dsl/matchers.rb +13 -0
- data/lib/spec/example.rb +4 -0
- data/lib/spec/example/before_and_after_hooks.rb +5 -20
- data/lib/spec/example/errors.rb +3 -3
- data/lib/spec/example/example_description.rb +15 -0
- data/lib/spec/example/example_group.rb +0 -15
- data/lib/spec/example/example_group_factory.rb +34 -46
- data/lib/spec/example/example_group_hierarchy.rb +53 -0
- data/lib/spec/example/example_group_methods.rb +101 -211
- data/lib/spec/example/example_methods.rb +61 -81
- data/lib/spec/example/module_reopening_fix.rb +23 -1
- data/lib/spec/example/pending.rb +3 -2
- data/lib/spec/example/predicate_matchers.rb +47 -0
- data/lib/spec/example/subject.rb +91 -0
- data/lib/spec/expectations.rb +1 -1
- data/lib/spec/expectations/differs/default.rb +0 -1
- data/lib/spec/expectations/extensions.rb +0 -1
- data/lib/spec/expectations/handler.rb +13 -6
- data/lib/spec/interop/test.rb +5 -0
- data/lib/spec/interop/test/unit/testcase.rb +5 -22
- data/lib/spec/matchers.rb +22 -8
- data/lib/spec/matchers/be.rb +4 -9
- data/lib/spec/matchers/be_close.rb +20 -5
- data/lib/spec/matchers/be_instance_of.rb +45 -0
- data/lib/spec/matchers/be_kind_of.rb +45 -0
- data/lib/spec/matchers/change.rb +8 -6
- data/lib/spec/matchers/compatibility.rb +14 -0
- data/lib/spec/matchers/eql.rb +24 -6
- data/lib/spec/matchers/equal.rb +24 -6
- data/lib/spec/matchers/exist.rb +21 -5
- data/lib/spec/matchers/extensions/instance_exec.rb +25 -0
- data/lib/spec/matchers/generated_descriptions.rb +2 -2
- data/lib/spec/matchers/has.rb +28 -11
- data/lib/spec/matchers/have.rb +2 -2
- data/lib/spec/matchers/include.rb +2 -2
- data/lib/spec/matchers/match.rb +25 -7
- data/lib/spec/matchers/match_array.rb +3 -3
- data/lib/spec/matchers/matcher.rb +51 -0
- data/lib/spec/matchers/method_missing.rb +2 -2
- data/lib/spec/matchers/operator_matcher.rb +12 -5
- data/lib/spec/matchers/raise_error.rb +3 -3
- data/lib/spec/matchers/respond_to.rb +3 -3
- data/lib/spec/matchers/satisfy.rb +7 -7
- data/lib/spec/matchers/throw_symbol.rb +3 -5
- data/lib/spec/mocks.rb +3 -3
- data/lib/spec/mocks/argument_expectation.rb +15 -15
- data/lib/spec/mocks/{argument_constraints.rb → argument_matchers.rb} +19 -23
- data/lib/spec/mocks/error_generator.rb +5 -8
- data/lib/spec/mocks/framework.rb +1 -1
- data/lib/spec/mocks/message_expectation.rb +5 -13
- data/lib/spec/mocks/mock.rb +4 -5
- data/lib/spec/mocks/proxy.rb +9 -5
- data/lib/spec/mocks/spec_methods.rb +10 -1
- data/lib/spec/rake/spectask.rb +0 -1
- data/lib/spec/runner.rb +6 -28
- data/lib/spec/runner/configuration.rb +3 -3
- data/lib/spec/runner/drb_command_line.rb +2 -1
- data/lib/spec/runner/example_group_runner.rb +3 -2
- data/lib/spec/runner/formatter/base_text_formatter.rb +34 -19
- data/lib/spec/runner/formatter/failing_example_groups_formatter.rb +3 -5
- data/lib/spec/runner/formatter/html_formatter.rb +2 -3
- data/lib/spec/runner/formatter/nested_text_formatter.rb +7 -25
- data/lib/spec/runner/formatter/progress_bar_formatter.rb +1 -1
- data/lib/spec/runner/formatter/snippet_extractor.rb +1 -1
- data/lib/spec/runner/formatter/specdoc_formatter.rb +1 -7
- data/lib/spec/runner/heckle_runner.rb +3 -6
- data/lib/spec/runner/heckle_runner_unsupported.rb +1 -1
- data/lib/spec/runner/option_parser.rb +19 -21
- data/lib/spec/runner/options.rb +32 -27
- data/lib/spec/runner/reporter.rb +8 -9
- data/lib/spec/test/unit.rb +10 -0
- data/lib/spec/version.rb +2 -2
- data/{features/support → resources}/helpers/cmdline.rb +2 -2
- data/resources/rake/verify_rcov.rake +1 -1
- data/resources/spec/example_group_with_should_methods.rb +1 -1
- data/resources/spec/simple_spec.rb +1 -1
- data/resources/test/spec_and_test_together.rb +2 -3
- data/resources/test/spec_including_test_but_not_unit.rb +1 -1
- data/resources/test/test_case_with_should_methods.rb +2 -3
- data/spec/autotest/autotest_helper.rb +0 -1
- data/spec/autotest/rspec_spec.rb +95 -98
- data/spec/spec/dsl/main_spec.rb +3 -3
- data/spec/spec/dsl/matchers_spec.rb +25 -0
- data/spec/spec/example/example_group_class_definition_spec.rb +14 -15
- data/spec/spec/example/example_group_factory_spec.rb +31 -44
- data/spec/spec/example/example_group_methods_spec.rb +86 -52
- data/spec/spec/example/example_group_spec.rb +32 -79
- data/spec/spec/example/example_matcher_spec.rb +10 -10
- data/spec/spec/example/example_methods_spec.rb +108 -242
- data/spec/spec/example/nested_example_group_spec.rb +2 -2
- data/spec/spec/example/pending_module_spec.rb +66 -41
- data/spec/spec/example/shared_example_group_spec.rb +4 -4
- data/spec/spec/{matchers → expectations}/handler_spec.rb +52 -4
- data/spec/spec/interop/test/unit/resources/spec_that_fails.rb +2 -2
- data/spec/spec/interop/test/unit/resources/spec_that_passes.rb +2 -2
- data/spec/spec/interop/test/unit/resources/spec_with_errors.rb +2 -2
- data/spec/spec/interop/test/unit/resources/spec_with_options_hash.rb +2 -2
- data/spec/spec/interop/test/unit/resources/test_case_that_fails.rb +2 -2
- data/spec/spec/interop/test/unit/resources/test_case_that_passes.rb +2 -2
- data/spec/spec/interop/test/unit/resources/test_case_with_errors.rb +2 -2
- data/spec/spec/interop/test/unit/resources/testsuite_adapter_spec_with_test_unit.rb +2 -2
- data/spec/spec/interop/test/unit/testcase_spec.rb +0 -4
- data/spec/spec/matchers/be_close_spec.rb +1 -1
- data/spec/spec/matchers/be_instance_of_spec.rb +29 -0
- data/spec/spec/matchers/be_kind_of_spec.rb +29 -0
- data/spec/spec/matchers/change_spec.rb +20 -0
- data/spec/spec/matchers/compatibility_spec.rb +34 -0
- data/spec/spec/matchers/description_generation_spec.rb +0 -12
- data/spec/spec/matchers/eql_spec.rb +2 -2
- data/spec/spec/matchers/equal_spec.rb +2 -2
- data/spec/spec/matchers/exist_spec.rb +8 -4
- data/spec/spec/matchers/have_spec.rb +4 -4
- data/spec/spec/matchers/match_spec.rb +2 -2
- data/spec/spec/matchers/matcher_methods_spec.rb +1 -1
- data/spec/spec/matchers/matcher_spec.rb +97 -0
- data/spec/spec/matchers/throw_symbol_spec.rb +8 -8
- data/spec/spec/mocks/{bug_report_496.rb → bug_report_496_spec.rb} +0 -0
- data/spec/spec/mocks/{failing_mock_argument_constraints_spec.rb → failing_argument_matchers_spec.rb} +2 -2
- data/spec/spec/mocks/hash_including_matcher_spec.rb +4 -4
- data/spec/spec/mocks/hash_not_including_matcher_spec.rb +3 -3
- data/spec/spec/mocks/mock_spec.rb +27 -2
- data/spec/spec/mocks/nil_expectation_warning_spec.rb +1 -1
- data/spec/spec/mocks/partial_mock_spec.rb +18 -3
- data/spec/spec/mocks/{passing_mock_argument_constraints_spec.rb → passing_argument_matchers_spec.rb} +6 -6
- data/spec/spec/mocks/stubbed_message_expectations_spec.rb +13 -1
- data/spec/spec/package/bin_spec_spec.rb +2 -2
- data/spec/spec/runner/configuration_spec.rb +12 -12
- data/spec/spec/runner/drb_command_line_spec.rb +71 -73
- data/spec/spec/runner/formatter/base_text_formatter_spec.rb +82 -1
- data/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +8 -8
- data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +4 -4
- data/spec/spec/runner/formatter/html_formatted-1.8.6.html +8 -8
- data/spec/spec/runner/formatter/html_formatted-1.8.7.html +38 -26
- data/spec/spec/runner/formatter/html_formatted-1.9.1.html +61 -53
- data/spec/spec/runner/formatter/html_formatter_spec.rb +100 -48
- data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +20 -34
- data/spec/spec/runner/formatter/profile_formatter_spec.rb +2 -1
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +9 -6
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +6 -6
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +20 -20
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.7.html +38 -26
- data/spec/spec/runner/formatter/text_mate_formatted-1.9.1.html +55 -47
- data/spec/spec/runner/formatter/{spec_mate_formatter_spec.rb → text_mate_formatter_spec.rb} +11 -9
- data/spec/spec/runner/heckle_runner_spec.rb +1 -1
- data/spec/spec/runner/heckler_spec.rb +1 -1
- data/spec/spec/runner/option_parser_spec.rb +28 -11
- data/spec/spec/runner/options_spec.rb +34 -0
- data/spec/spec/runner/reporter_spec.rb +66 -62
- data/spec/spec/runner/resources/utf8_encoded.rb +1 -0
- data/spec/spec/runner/spec_drb.opts +1 -0
- data/spec/spec/runner_spec.rb +7 -5
- data/spec/spec_helper.rb +24 -2
- metadata +49 -90
- data/examples/passing/autogenerated_docstrings_example.rb +0 -25
- data/examples/passing/before_and_after_example.rb +0 -40
- data/examples/passing/behave_as_example.rb +0 -45
- data/examples/passing/legacy_spec.rb +0 -11
- data/examples/passing/priority.txt +0 -1
- data/features/support/helpers/story_helper.rb +0 -16
- data/lib/spec/expectations/extensions/string_and_symbol.rb +0 -17
- data/lib/spec/runner/formatter/story/html_formatter.rb +0 -174
- data/lib/spec/runner/formatter/story/plain_text_formatter.rb +0 -194
- data/lib/spec/runner/formatter/story/progress_bar_formatter.rb +0 -42
- data/lib/spec/story.rb +0 -10
- data/lib/spec/story/extensions.rb +0 -3
- data/lib/spec/story/extensions/main.rb +0 -86
- data/lib/spec/story/extensions/regexp.rb +0 -9
- data/lib/spec/story/extensions/string.rb +0 -9
- data/lib/spec/story/given_scenario.rb +0 -14
- data/lib/spec/story/runner.rb +0 -57
- data/lib/spec/story/runner/plain_text_story_runner.rb +0 -48
- data/lib/spec/story/runner/scenario_collector.rb +0 -18
- data/lib/spec/story/runner/scenario_runner.rb +0 -54
- data/lib/spec/story/runner/story_mediator.rb +0 -137
- data/lib/spec/story/runner/story_parser.rb +0 -247
- data/lib/spec/story/runner/story_runner.rb +0 -74
- data/lib/spec/story/scenario.rb +0 -14
- data/lib/spec/story/step.rb +0 -70
- data/lib/spec/story/step_group.rb +0 -89
- data/lib/spec/story/step_mother.rb +0 -38
- data/lib/spec/story/story.rb +0 -39
- data/lib/spec/story/world.rb +0 -124
- data/resources/spec/spec_with_flexmock.rb +0 -19
- data/rspec.gemspec +0 -32
- data/spec/spec/matchers/mock_constraint_matchers_spec.rb +0 -24
- data/spec/spec/runner/formatter/story/html_formatter_spec.rb +0 -135
- data/spec/spec/runner/formatter/story/plain_text_formatter_spec.rb +0 -600
- data/spec/spec/runner/formatter/story/progress_bar_formatter_spec.rb +0 -82
- data/spec/spec/spec_spec.rb +0 -21
- data/spec/spec/story/builders.rb +0 -46
- data/spec/spec/story/extensions/main_spec.rb +0 -161
- data/spec/spec/story/extensions_spec.rb +0 -14
- data/spec/spec/story/given_scenario_spec.rb +0 -27
- data/spec/spec/story/runner/plain_text_story_runner_spec.rb +0 -90
- data/spec/spec/story/runner/scenario_collector_spec.rb +0 -27
- data/spec/spec/story/runner/scenario_runner_spec.rb +0 -214
- data/spec/spec/story/runner/story_mediator_spec.rb +0 -143
- data/spec/spec/story/runner/story_parser_spec.rb +0 -401
- data/spec/spec/story/runner/story_runner_spec.rb +0 -294
- data/spec/spec/story/runner_spec.rb +0 -93
- data/spec/spec/story/scenario_spec.rb +0 -18
- data/spec/spec/story/step_group_spec.rb +0 -157
- data/spec/spec/story/step_mother_spec.rb +0 -84
- data/spec/spec/story/step_spec.rb +0 -272
- data/spec/spec/story/story_helper.rb +0 -2
- data/spec/spec/story/story_spec.rb +0 -84
- data/spec/spec/story/world_spec.rb +0 -423
- data/story_server/prototype/javascripts/builder.js +0 -136
- data/story_server/prototype/javascripts/controls.js +0 -972
- data/story_server/prototype/javascripts/dragdrop.js +0 -976
- data/story_server/prototype/javascripts/effects.js +0 -1117
- data/story_server/prototype/javascripts/prototype.js +0 -4140
- data/story_server/prototype/javascripts/rspec.js +0 -149
- data/story_server/prototype/javascripts/scriptaculous.js +0 -58
- data/story_server/prototype/javascripts/slider.js +0 -276
- data/story_server/prototype/javascripts/sound.js +0 -55
- data/story_server/prototype/javascripts/unittest.js +0 -568
- data/story_server/prototype/lib/server.rb +0 -24
- data/story_server/prototype/stories.html +0 -176
- data/story_server/prototype/stylesheets/rspec.css +0 -136
- data/story_server/prototype/stylesheets/test.css +0 -90
@@ -43,7 +43,7 @@ function makeYellow(element_id) {
|
|
43
43
|
</script>
|
44
44
|
<style type="text/css">
|
45
45
|
#rspec-header {
|
46
|
-
background: #65C400; color: #fff; height:
|
46
|
+
background: #65C400; color: #fff; height: 4em;
|
47
47
|
}
|
48
48
|
|
49
49
|
.rspec-report h1 {
|
@@ -51,7 +51,7 @@ function makeYellow(element_id) {
|
|
51
51
|
padding: 10px;
|
52
52
|
font-family: "Lucida Grande", Helvetica, sans-serif;
|
53
53
|
font-size: 1.8em;
|
54
|
-
|
54
|
+
position: absolute;
|
55
55
|
}
|
56
56
|
|
57
57
|
#summary {
|
@@ -192,14 +192,15 @@ a {
|
|
192
192
|
<div class="failure" id="failure_1">
|
193
193
|
<div class="message"><pre>Mock 'poke me' expected :poke with (any args) once, but received it 0 times</pre></div>
|
194
194
|
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb&line=13">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb:13</a> :in `block (2 levels) in <top (required)>'
|
195
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
196
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
197
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
198
|
-
<pre class="ruby"><code><span class="linenum">11</span>
|
199
|
-
<span class="linenum">12</span>
|
200
|
-
<span class="offending"><span class="linenum">13</span>
|
201
|
-
<span class="linenum">14</span>
|
202
|
-
<span class="linenum">15</span>
|
195
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=49">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:49</a> :in `block (4 levels) in <module:Formatter>'
|
196
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `chdir'
|
197
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
|
198
|
+
<pre class="ruby"><code><span class="linenum">11</span> it "should fail when expected message not received" do
|
199
|
+
<span class="linenum">12</span> mock = mock("poke me")
|
200
|
+
<span class="offending"><span class="linenum">13</span> mock.should_receive(:poke)</span>
|
201
|
+
<span class="linenum">14</span> end
|
202
|
+
<span class="linenum">15</span>
|
203
|
+
<span class="linenum">16</span><span class="comment"># gem install syntax to get syntax highlighting</span></code></pre>
|
203
204
|
</div>
|
204
205
|
</dd>
|
205
206
|
<script type="text/javascript">moveProgressBar('17.6');</script>
|
@@ -208,14 +209,15 @@ a {
|
|
208
209
|
<div class="failure" id="failure_2">
|
209
210
|
<div class="message"><pre>Mock 'one two three' received :three out of order</pre></div>
|
210
211
|
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb&line=22">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb:22</a> :in `block (2 levels) in <top (required)>'
|
211
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
212
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
213
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
214
|
-
<pre class="ruby"><code><span class="linenum">20</span>
|
215
|
-
<span class="linenum">21</span>
|
216
|
-
<span class="offending"><span class="linenum">22</span>
|
217
|
-
<span class="linenum">23</span>
|
218
|
-
<span class="linenum">24</span>
|
212
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=49">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:49</a> :in `block (4 levels) in <module:Formatter>'
|
213
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `chdir'
|
214
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
|
215
|
+
<pre class="ruby"><code><span class="linenum">20</span> mock.should_receive(:three).ordered
|
216
|
+
<span class="linenum">21</span> mock.one
|
217
|
+
<span class="offending"><span class="linenum">22</span> mock.three</span>
|
218
|
+
<span class="linenum">23</span> mock.two
|
219
|
+
<span class="linenum">24</span> end
|
220
|
+
<span class="linenum">25</span><span class="comment"># gem install syntax to get syntax highlighting</span></code></pre>
|
219
221
|
</div>
|
220
222
|
</dd>
|
221
223
|
<script type="text/javascript">moveProgressBar('23.5');</script>
|
@@ -224,13 +226,15 @@ a {
|
|
224
226
|
<div class="failure" id="failure_3">
|
225
227
|
<div class="message"><pre>Mock 'don't talk to me' expected :any_message_at_all with (no args) 0 times, but received it once</pre></div>
|
226
228
|
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb&line=29">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb:29</a> :in `block (2 levels) in <top (required)>'
|
227
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
228
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
229
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
230
|
-
<pre class="ruby"><code><span class="linenum">27</span>
|
231
|
-
<span class="linenum">28</span>
|
232
|
-
<span class="offending"><span class="linenum">29</span>
|
233
|
-
<span class="linenum">30</span>
|
229
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=49">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:49</a> :in `block (4 levels) in <module:Formatter>'
|
230
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `chdir'
|
231
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
|
232
|
+
<pre class="ruby"><code><span class="linenum">27</span> mock = mock("don't talk to me")
|
233
|
+
<span class="linenum">28</span> mock.should_not_receive(:any_message_at_all)
|
234
|
+
<span class="offending"><span class="linenum">29</span> mock.any_message_at_all</span>
|
235
|
+
<span class="linenum">30</span> end
|
236
|
+
<span class="linenum">31</span>
|
237
|
+
<span class="linenum">32</span><span class="comment"># gem install syntax to get syntax highlighting</span></code></pre>
|
234
238
|
</div>
|
235
239
|
</dd>
|
236
240
|
<script type="text/javascript">moveProgressBar('29.4');</script>
|
@@ -239,14 +243,15 @@ a {
|
|
239
243
|
<div class="failure" id="failure_4">
|
240
244
|
<div class="message"><pre>Expected pending 'here is the bug' to fail. No Error was raised.</pre></div>
|
241
245
|
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb&line=33">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb:33</a> :in `block (2 levels) in <top (required)>'
|
242
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
243
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
244
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
246
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=49">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:49</a> :in `block (4 levels) in <module:Formatter>'
|
247
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `chdir'
|
248
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
|
245
249
|
<pre class="ruby"><code><span class="linenum">31</span>
|
246
|
-
<span class="linenum">32</span>
|
247
|
-
<span class="offending"><span class="linenum">33</span>
|
248
|
-
<span class="linenum">34</span>
|
249
|
-
<span class="linenum">35</span>
|
250
|
+
<span class="linenum">32</span> it "has a bug we need to fix" do
|
251
|
+
<span class="offending"><span class="linenum">33</span> pending "here is the bug" do</span>
|
252
|
+
<span class="linenum">34</span> # Actually, no. It's fixed. This will fail because it passes :-)
|
253
|
+
<span class="linenum">35</span> mock = mock("Bug")
|
254
|
+
<span class="linenum">36</span><span class="comment"># gem install syntax to get syntax highlighting</span></code></pre>
|
250
255
|
</div>
|
251
256
|
</dd>
|
252
257
|
</dl>
|
@@ -269,13 +274,15 @@ Diff:
|
|
269
274
|
framework for Ruby
|
270
275
|
</pre></div>
|
271
276
|
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/diffing_spec.rb&line=13">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/diffing_spec.rb:13</a> :in `block (2 levels) in <top (required)>'
|
272
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
273
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
274
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
275
|
-
<pre class="ruby"><code><span class="linenum">11</span
|
276
|
-
<span class="linenum">12</span
|
277
|
-
<span class="offending"><span class="linenum">13</span>
|
278
|
-
<span class="linenum">14</span>
|
277
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=49">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:49</a> :in `block (4 levels) in <module:Formatter>'
|
278
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `chdir'
|
279
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
|
280
|
+
<pre class="ruby"><code><span class="linenum">11</span>framework for Ruby
|
281
|
+
<span class="linenum">12</span>EOF
|
282
|
+
<span class="offending"><span class="linenum">13</span> usa.should == uk</span>
|
283
|
+
<span class="linenum">14</span> end
|
284
|
+
<span class="linenum">15</span>
|
285
|
+
<span class="linenum">16</span><span class="comment"># gem install syntax to get syntax highlighting</span></code></pre>
|
279
286
|
</div>
|
280
287
|
</dd>
|
281
288
|
<script type="text/javascript">moveProgressBar('41.1');</script>
|
@@ -300,14 +307,15 @@ Diff:
|
|
300
307
|
>
|
301
308
|
</pre></div>
|
302
309
|
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/diffing_spec.rb&line=34">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/diffing_spec.rb:34</a> :in `block (2 levels) in <top (required)>'
|
303
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
304
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
305
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/
|
306
|
-
<pre class="ruby"><code><span class="linenum">32</span>
|
307
|
-
<span class="linenum">33</span>
|
308
|
-
<span class="offending"><span class="linenum">34</span>
|
309
|
-
<span class="linenum">35</span>
|
310
|
-
<span class="linenum">36</span
|
310
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=49">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:49</a> :in `block (4 levels) in <module:Formatter>'
|
311
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `chdir'
|
312
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
|
313
|
+
<pre class="ruby"><code><span class="linenum">32</span> expected = Animal.new "bob", "giraffe"
|
314
|
+
<span class="linenum">33</span> actual = Animal.new "bob", "tortoise"
|
315
|
+
<span class="offending"><span class="linenum">34</span> expected.should eql(actual)</span>
|
316
|
+
<span class="linenum">35</span> end
|
317
|
+
<span class="linenum">36</span>end
|
318
|
+
<span class="linenum">37</span><span class="comment"># gem install syntax to get syntax highlighting</span></code></pre>
|
311
319
|
</div>
|
312
320
|
</dd>
|
313
321
|
</dl>
|
@@ -1,10 +1,8 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
return
|
7
|
-
end
|
2
|
+
|
3
|
+
begin # See rescue all the way at the bottom
|
4
|
+
|
5
|
+
require 'nokogiri' # Needed to compare generated with wanted HTML
|
8
6
|
require 'spec/runner/formatter/text_mate_formatter'
|
9
7
|
|
10
8
|
module Spec
|
@@ -51,10 +49,10 @@ module Spec
|
|
51
49
|
# Spec::Runner::CommandLine.run(
|
52
50
|
# ::Spec::Runner::OptionParser.parse(args, err, out)
|
53
51
|
# )
|
54
|
-
#
|
52
|
+
#
|
55
53
|
# seconds = /\d+\.\d+ seconds/
|
56
54
|
# html = out.string.gsub seconds, 'x seconds'
|
57
|
-
#
|
55
|
+
#
|
58
56
|
# File.open(expected_file, 'w') {|io| io.write(html)}
|
59
57
|
# end
|
60
58
|
# end
|
@@ -64,7 +62,7 @@ module Spec
|
|
64
62
|
it "should produce HTML identical to the one we designed manually with --diff" do
|
65
63
|
produces_html_identical_to_manually_designed_document("--diff") do |html|
|
66
64
|
suffix = jruby? ? '-jruby' : ''
|
67
|
-
expected_file = File.dirname(__FILE__) + "/text_mate_formatted-#{::
|
65
|
+
expected_file = File.dirname(__FILE__) + "/text_mate_formatted-#{::RUBY_VERSION}#{suffix}.html"
|
68
66
|
unless File.file?(expected_file)
|
69
67
|
raise "There is no HTML file with expected content for this platform: #{expected_file}"
|
70
68
|
end
|
@@ -102,3 +100,7 @@ module Spec
|
|
102
100
|
end
|
103
101
|
end
|
104
102
|
end
|
103
|
+
|
104
|
+
rescue LoadError
|
105
|
+
warn "nokogiri not loaded -- skipping TextMateFormatter specs"
|
106
|
+
end
|
@@ -144,19 +144,19 @@ describe "OptionParser" do
|
|
144
144
|
options.formatters[0].class.should equal(Spec::Runner::Formatter::HtmlFormatter)
|
145
145
|
end
|
146
146
|
|
147
|
-
it "should use html story formatter when format is h" do
|
148
|
-
options = parse(["--format", "h"])
|
149
|
-
options.story_formatters[0].class.should equal(Spec::Runner::Formatter::Story::HtmlFormatter)
|
150
|
-
end
|
151
|
-
|
152
147
|
it "should use html formatter when format is html" do
|
153
148
|
options = parse(["--format", "html"])
|
154
149
|
options.formatters[0].class.should equal(Spec::Runner::Formatter::HtmlFormatter)
|
155
150
|
end
|
156
151
|
|
157
|
-
it "should use
|
158
|
-
options = parse(["--format", "
|
159
|
-
options.
|
152
|
+
it "should use base formatter when format is s" do
|
153
|
+
options = parse(["--format", "l"])
|
154
|
+
options.formatters[0].class.should equal(Spec::Runner::Formatter::BaseFormatter)
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should use base formatter when format is silent" do
|
158
|
+
options = parse(["--format", "silent"])
|
159
|
+
options.formatters[0].class.should equal(Spec::Runner::Formatter::BaseFormatter)
|
160
160
|
end
|
161
161
|
|
162
162
|
it "should use html formatter with explicit output when format is html:test.html" do
|
@@ -299,7 +299,13 @@ describe "OptionParser" do
|
|
299
299
|
it "should barf when --heckle is specified (and platform is windows)" do
|
300
300
|
lambda do
|
301
301
|
options = parse(["--heckle", "Spec"])
|
302
|
-
end.should raise_error(StandardError,
|
302
|
+
end.should raise_error(StandardError, /Heckle is not supported/)
|
303
|
+
end
|
304
|
+
elsif Spec::Ruby.version.to_f == 1.9
|
305
|
+
it "should barf when --heckle is specified (and platform is Ruby 1.9)" do
|
306
|
+
lambda do
|
307
|
+
options = parse(["--heckle", "Spec"])
|
308
|
+
end.should raise_error(StandardError, /Heckle is not supported/)
|
303
309
|
end
|
304
310
|
else
|
305
311
|
it "should heckle when --heckle is specified (and platform is not windows)" do
|
@@ -320,11 +326,17 @@ describe "OptionParser" do
|
|
320
326
|
end
|
321
327
|
|
322
328
|
it "should run parse drb after parsing options" do
|
323
|
-
@parser.
|
324
|
-
@parser.should_receive(:parse_drb).with(["--drb"]).and_return(true)
|
329
|
+
@parser.should_receive(:parse_drb).with(no_args).and_return(true)
|
325
330
|
options = parse(["--options", File.dirname(__FILE__) + "/spec_drb.opts"])
|
326
331
|
end
|
327
332
|
|
333
|
+
it "should send all the arguments others than --drb back to the parser after parsing options" do
|
334
|
+
Spec::Runner::DrbCommandLine.should_receive(:run).and_return do |options|
|
335
|
+
options.argv.should == ["example_file.rb", "--colour"]
|
336
|
+
end
|
337
|
+
options = parse(["example_file.rb", "--options", File.dirname(__FILE__) + "/spec_drb.opts"])
|
338
|
+
end
|
339
|
+
|
328
340
|
it "should read spaced and multi-line options from file when --options is specified" do
|
329
341
|
options = parse(["--options", File.dirname(__FILE__) + "/spec_spaced.opts"])
|
330
342
|
options.diff_format.should_not be_nil
|
@@ -403,4 +415,9 @@ describe "OptionParser" do
|
|
403
415
|
options = parse(["--runner", "Custom::ExampleGroupRunner:something"])
|
404
416
|
options.run_examples
|
405
417
|
end
|
418
|
+
|
419
|
+
it "sets options.autospec to true with --autospec" do
|
420
|
+
options = parse(["--autospec"])
|
421
|
+
options.autospec.should be(true)
|
422
|
+
end
|
406
423
|
end
|
@@ -312,6 +312,40 @@ module Spec
|
|
312
312
|
end
|
313
313
|
|
314
314
|
describe "#run_examples" do
|
315
|
+
describe "with global predicate matchers" do
|
316
|
+
it "defines global predicate matcher methods on ExampleMethods" do
|
317
|
+
Spec::Runner.configuration.stub!(:predicate_matchers).and_return({:this => :that?})
|
318
|
+
group = Class.new(::Spec::Example::ExampleGroupDouble).describe("Some Examples")
|
319
|
+
example = group.new("")
|
320
|
+
|
321
|
+
@options.run_examples
|
322
|
+
example.this
|
323
|
+
end
|
324
|
+
|
325
|
+
after(:each) do
|
326
|
+
Spec::Example::ExampleMethods.class_eval "undef :this"
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
describe "with a mock framework defined as a Symbol" do
|
331
|
+
it "includes Spec::Adapters::MockFramework" do
|
332
|
+
Spec::Runner.configuration.stub!(:mock_framework).and_return('spec/adapters/mock_frameworks/rspec')
|
333
|
+
|
334
|
+
Spec::Example::ExampleMethods.should_receive(:include).with(Spec::Adapters::MockFramework)
|
335
|
+
|
336
|
+
@options.run_examples
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
describe "with a mock framework defined as a Module" do
|
341
|
+
it "includes the module in ExampleMethods" do
|
342
|
+
mod = Module.new
|
343
|
+
Spec::Runner.configuration.stub!(:mock_framework).and_return(mod)
|
344
|
+
Spec::Example::ExampleMethods.should_receive(:include).with(mod)
|
345
|
+
@options.run_examples
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
315
349
|
describe "when not given a custom runner" do
|
316
350
|
it "should use the standard" do
|
317
351
|
runner = ::Spec::Runner::ExampleGroupRunner.new(@options)
|
@@ -13,15 +13,15 @@ module Spec
|
|
13
13
|
options.formatters << formatter
|
14
14
|
@reporter = Reporter.new(options)
|
15
15
|
@example_group = create_example_group("example_group")
|
16
|
-
reporter
|
16
|
+
example_group.notify(reporter)
|
17
17
|
end
|
18
18
|
|
19
19
|
def failure
|
20
|
-
Mocks::
|
20
|
+
Mocks::ArgumentMatchers::DuckTypeMatcher.new(:header, :exception)
|
21
21
|
end
|
22
22
|
|
23
|
-
def create_example_group(
|
24
|
-
example_group = Spec::Example::ExampleGroup.describe(
|
23
|
+
def create_example_group(text)
|
24
|
+
example_group = Spec::Example::ExampleGroup.describe(text) do
|
25
25
|
it "should do something" do
|
26
26
|
end
|
27
27
|
end
|
@@ -31,12 +31,12 @@ module Spec
|
|
31
31
|
it "should assign itself as the reporter to options" do
|
32
32
|
options.reporter.should equal(@reporter)
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it "should tell formatter when example_group is added" do
|
36
36
|
formatter.should_receive(:add_example_group).with(example_group)
|
37
|
-
|
37
|
+
example_group.notify(reporter)
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
it "should handle multiple example_groups with same name" do
|
41
41
|
formatter.should_receive(:add_example_group).exactly(3).times
|
42
42
|
formatter.should_receive(:example_started).exactly(3).times
|
@@ -45,27 +45,31 @@ module Spec
|
|
45
45
|
formatter.should_receive(:dump_pending)
|
46
46
|
formatter.should_receive(:close).with(no_args)
|
47
47
|
formatter.should_receive(:dump_summary).with(anything(), 3, 0, 0)
|
48
|
-
|
49
|
-
reporter.example_started("spec 1")
|
50
|
-
reporter.example_finished("spec 1")
|
51
|
-
|
52
|
-
reporter.example_started("spec 2")
|
53
|
-
reporter.example_finished("spec 2")
|
54
|
-
|
55
|
-
reporter.example_started("spec 3")
|
56
|
-
reporter.example_finished("spec 3")
|
48
|
+
create_example_group("example_group").notify(reporter)
|
49
|
+
reporter.example_started(description_of("spec 1"))
|
50
|
+
reporter.example_finished(description_of("spec 1"))
|
51
|
+
create_example_group("example_group").notify(reporter)
|
52
|
+
reporter.example_started(description_of("spec 2"))
|
53
|
+
reporter.example_finished(description_of("spec 2"))
|
54
|
+
create_example_group("example_group").notify(reporter)
|
55
|
+
reporter.example_started(description_of("spec 3"))
|
56
|
+
reporter.example_finished(description_of("spec 3"))
|
57
57
|
reporter.dump
|
58
58
|
end
|
59
|
+
|
60
|
+
def description_of(example)
|
61
|
+
::Spec::Example::ExampleDescription.new(String === example ? example : example.description)
|
62
|
+
end
|
59
63
|
|
60
64
|
it "should handle multiple examples with the same name" do
|
61
65
|
error=RuntimeError.new
|
62
|
-
passing =
|
63
|
-
failing =
|
66
|
+
passing = ::Spec::Example::ExampleGroupDouble.new("an example")
|
67
|
+
failing = ::Spec::Example::ExampleGroupDouble.new("an example")
|
64
68
|
|
65
69
|
formatter.should_receive(:add_example_group).exactly(2).times
|
66
|
-
formatter.should_receive(:example_passed).with(passing).exactly(2).times
|
67
|
-
formatter.should_receive(:example_failed).with(failing, 1, failure)
|
68
|
-
formatter.should_receive(:example_failed).with(failing, 2, failure)
|
70
|
+
formatter.should_receive(:example_passed).with(description_of(passing)).exactly(2).times
|
71
|
+
formatter.should_receive(:example_failed).with(description_of(failing), 1, failure)
|
72
|
+
formatter.should_receive(:example_failed).with(description_of(failing), 2, failure)
|
69
73
|
formatter.should_receive(:dump_failure).exactly(2).times
|
70
74
|
formatter.should_receive(:start_dump)
|
71
75
|
formatter.should_receive(:dump_pending)
|
@@ -73,13 +77,13 @@ module Spec
|
|
73
77
|
formatter.should_receive(:dump_summary).with(anything(), 4, 2, 0)
|
74
78
|
backtrace_tweaker.should_receive(:tweak_backtrace).twice
|
75
79
|
|
76
|
-
|
77
|
-
reporter.example_finished(passing)
|
78
|
-
reporter.example_finished(failing, error)
|
80
|
+
create_example_group("example_group").notify(reporter)
|
81
|
+
reporter.example_finished(description_of(passing))
|
82
|
+
reporter.example_finished(description_of(failing), error)
|
79
83
|
|
80
|
-
|
81
|
-
reporter.example_finished(passing)
|
82
|
-
reporter.example_finished(failing, error)
|
84
|
+
create_example_group("example_group").notify(reporter)
|
85
|
+
reporter.example_finished(description_of(passing))
|
86
|
+
reporter.example_finished(description_of(failing), error)
|
83
87
|
reporter.dump
|
84
88
|
end
|
85
89
|
|
@@ -90,7 +94,7 @@ module Spec
|
|
90
94
|
formatter.should_receive(:close).with(no_args)
|
91
95
|
reporter.dump
|
92
96
|
end
|
93
|
-
|
97
|
+
|
94
98
|
it "should push time to formatter" do
|
95
99
|
formatter.should_receive(:start).with(5)
|
96
100
|
formatter.should_receive(:start_dump)
|
@@ -103,57 +107,57 @@ module Spec
|
|
103
107
|
reporter.end
|
104
108
|
reporter.dump
|
105
109
|
end
|
106
|
-
|
110
|
+
|
107
111
|
describe "reporting one passing example" do
|
108
112
|
it "should tell formatter example passed" do
|
109
113
|
formatter.should_receive(:example_passed)
|
110
|
-
reporter.example_finished("example")
|
114
|
+
reporter.example_finished(description_of("example"))
|
111
115
|
end
|
112
|
-
|
116
|
+
|
113
117
|
it "should not delegate to backtrace tweaker" do
|
114
118
|
formatter.should_receive(:example_passed)
|
115
119
|
backtrace_tweaker.should_not_receive(:tweak_backtrace)
|
116
|
-
reporter.example_finished("example")
|
120
|
+
reporter.example_finished(description_of("example"))
|
117
121
|
end
|
118
|
-
|
122
|
+
|
119
123
|
it "should account for passing example in stats" do
|
120
124
|
formatter.should_receive(:example_passed)
|
121
125
|
formatter.should_receive(:start_dump)
|
122
126
|
formatter.should_receive(:dump_pending)
|
123
127
|
formatter.should_receive(:dump_summary).with(anything(), 1, 0, 0)
|
124
128
|
formatter.should_receive(:close).with(no_args)
|
125
|
-
reporter.example_finished("example")
|
129
|
+
reporter.example_finished(description_of("example"))
|
126
130
|
reporter.dump
|
127
131
|
end
|
128
132
|
end
|
129
|
-
|
133
|
+
|
130
134
|
describe "reporting one failing example" do
|
131
135
|
it "should tell formatter that example failed" do
|
132
136
|
example = example_group.it("should do something") {}
|
133
137
|
formatter.should_receive(:example_failed)
|
134
|
-
reporter.example_finished(example, RuntimeError.new)
|
138
|
+
reporter.example_finished(description_of(example), RuntimeError.new)
|
135
139
|
end
|
136
|
-
|
140
|
+
|
137
141
|
it "should delegate to backtrace tweaker" do
|
138
142
|
formatter.should_receive(:example_failed)
|
139
143
|
backtrace_tweaker.should_receive(:tweak_backtrace)
|
140
|
-
reporter.example_finished(ExampleGroup.new("example"), RuntimeError.new)
|
144
|
+
reporter.example_finished(description_of(ExampleGroup.new("example")), RuntimeError.new)
|
141
145
|
end
|
142
|
-
|
146
|
+
|
143
147
|
it "should account for failing example in stats" do
|
144
|
-
example =
|
145
|
-
formatter.should_receive(:example_failed).with(example, 1, failure)
|
148
|
+
example = ::Spec::Example::ExampleGroupDouble.new("example")
|
149
|
+
formatter.should_receive(:example_failed).with(description_of(example), 1, failure)
|
146
150
|
formatter.should_receive(:start_dump)
|
147
151
|
formatter.should_receive(:dump_pending)
|
148
152
|
formatter.should_receive(:dump_failure).with(1, anything())
|
149
153
|
formatter.should_receive(:dump_summary).with(anything(), 1, 1, 0)
|
150
154
|
formatter.should_receive(:close).with(no_args)
|
151
|
-
reporter.example_finished(example, RuntimeError.new)
|
155
|
+
reporter.example_finished(description_of(example), RuntimeError.new)
|
152
156
|
reporter.dump
|
153
157
|
end
|
154
|
-
|
158
|
+
|
155
159
|
end
|
156
|
-
|
160
|
+
|
157
161
|
describe "reporting one pending example (ExamplePendingError)" do
|
158
162
|
before :each do
|
159
163
|
@pending_error = Spec::Example::ExamplePendingError.new("reason")
|
@@ -162,22 +166,22 @@ module Spec
|
|
162
166
|
|
163
167
|
it "should tell formatter example is pending" do
|
164
168
|
example = ExampleGroup.new("example")
|
165
|
-
formatter.should_receive(:example_pending).with(example, "reason", @pending_caller)
|
169
|
+
formatter.should_receive(:example_pending).with(description_of(example), "reason", @pending_caller)
|
166
170
|
formatter.should_receive(:add_example_group).with(example_group)
|
167
|
-
|
168
|
-
reporter.example_finished(example, @pending_error)
|
171
|
+
example_group.notify(reporter)
|
172
|
+
reporter.example_finished(description_of(example), @pending_error)
|
169
173
|
end
|
170
|
-
|
174
|
+
|
171
175
|
it "should account for pending example in stats" do
|
172
176
|
example = ExampleGroup.new("example")
|
173
|
-
formatter.should_receive(:example_pending).with(example, "reason", @pending_caller)
|
177
|
+
formatter.should_receive(:example_pending).with(description_of(example), "reason", @pending_caller)
|
174
178
|
formatter.should_receive(:start_dump)
|
175
179
|
formatter.should_receive(:dump_pending)
|
176
180
|
formatter.should_receive(:dump_summary).with(anything(), 1, 0, 1)
|
177
181
|
formatter.should_receive(:close).with(no_args)
|
178
182
|
formatter.should_receive(:add_example_group).with(example_group)
|
179
|
-
|
180
|
-
reporter.example_finished(example, @pending_error)
|
183
|
+
example_group.notify(reporter)
|
184
|
+
reporter.example_finished(description_of(example), @pending_error)
|
181
185
|
reporter.dump
|
182
186
|
end
|
183
187
|
|
@@ -187,7 +191,7 @@ module Spec
|
|
187
191
|
|
188
192
|
@deprecated_formatter = Class.new(@formatter.class) do
|
189
193
|
attr_reader :example_passed_to_method, :message_passed_to_method
|
190
|
-
|
194
|
+
|
191
195
|
def example_pending(example_passed_to_method, message_passed_to_method)
|
192
196
|
@example_passed_to_method = example_passed_to_method
|
193
197
|
@message_passed_to_method = message_passed_to_method
|
@@ -199,16 +203,16 @@ module Spec
|
|
199
203
|
|
200
204
|
it "should pass the correct example to the formatter" do
|
201
205
|
example = ExampleGroup.new("example")
|
202
|
-
|
203
|
-
reporter.example_finished(example, @pending_error)
|
206
|
+
example_group.notify(reporter)
|
207
|
+
reporter.example_finished(description_of(example), @pending_error)
|
204
208
|
|
205
|
-
|
209
|
+
@deprecated_formatter.example_passed_to_method.should == description_of(example)
|
206
210
|
end
|
207
211
|
|
208
212
|
it "should pass the correct pending error message to the formatter" do
|
209
213
|
example = ExampleGroup.new("example")
|
210
|
-
|
211
|
-
reporter.example_finished(example, @pending_error)
|
214
|
+
example_group.notify(reporter)
|
215
|
+
reporter.example_finished(description_of(example), @pending_error)
|
212
216
|
|
213
217
|
@deprecated_formatter.message_passed_to_method.should == @pending_error.message
|
214
218
|
end
|
@@ -217,20 +221,20 @@ module Spec
|
|
217
221
|
Kernel.should_receive(:warn).with(Spec::Runner::Reporter::EXAMPLE_PENDING_DEPRECATION_WARNING)
|
218
222
|
|
219
223
|
example = ExampleGroup.new("example")
|
220
|
-
|
221
|
-
reporter.example_finished(example, @pending_error)
|
224
|
+
example_group.notify(reporter)
|
225
|
+
reporter.example_finished(description_of(example), @pending_error)
|
222
226
|
end
|
223
227
|
end
|
224
228
|
end
|
225
|
-
|
229
|
+
|
226
230
|
describe "reporting one pending example (PendingExampleFixedError)" do
|
227
231
|
it "should tell formatter pending example is fixed" do
|
228
232
|
formatter.should_receive(:example_failed) do |name, counter, failure|
|
229
233
|
failure.header.should == "'example_group should do something' FIXED"
|
230
234
|
end
|
231
235
|
formatter.should_receive(:add_example_group).with(example_group)
|
232
|
-
|
233
|
-
reporter.example_finished(example_group.examples.first, Spec::Example::PendingExampleFixedError.new("reason"))
|
236
|
+
example_group.notify(reporter)
|
237
|
+
reporter.example_finished(description_of(example_group.examples.first), Spec::Example::PendingExampleFixedError.new("reason"))
|
234
238
|
end
|
235
239
|
end
|
236
240
|
end
|