rspec 1.1.11 → 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.autotest +4 -0
- data/History.txt +55 -0
- data/Manifest.txt +102 -122
- data/README.txt +30 -12
- data/Rakefile +10 -10
- data/TODO.txt +10 -2
- data/{failing_examples → examples/failing}/README.txt +0 -0
- data/{failing_examples → examples/failing}/diffing_spec.rb +0 -0
- data/{failing_examples → examples/failing}/failing_autogenerated_docstrings_example.rb +0 -0
- data/{failing_examples/failure_in_teardown.rb → examples/failing/failure_in_after.rb} +1 -1
- data/{failing_examples/failure_in_setup.rb → examples/failing/failure_in_before.rb} +1 -1
- data/{failing_examples → examples/failing}/mocking_example.rb +0 -0
- data/{failing_examples → examples/failing}/mocking_with_flexmock.rb +0 -0
- data/{failing_examples → examples/failing}/mocking_with_mocha.rb +0 -0
- data/{failing_examples → examples/failing}/mocking_with_rr.rb +0 -0
- data/{failing_examples → examples/failing}/partial_mock_example.rb +0 -0
- data/{failing_examples → examples/failing}/predicate_example.rb +5 -0
- data/{failing_examples → examples/failing}/raising_example.rb +0 -0
- data/{failing_examples → examples/failing}/spec_helper.rb +1 -1
- data/{failing_examples → examples/failing}/syntax_error_example.rb +0 -0
- data/{failing_examples → examples/failing}/team_spec.rb +0 -0
- data/{failing_examples → examples/failing}/timeout_behaviour.rb +0 -0
- data/examples/{pure → passing}/autogenerated_docstrings_example.rb +6 -0
- data/examples/{pure → passing}/before_and_after_example.rb +0 -0
- data/examples/{pure → passing}/behave_as_example.rb +0 -0
- data/examples/{pure → passing}/custom_expectation_matchers.rb +0 -0
- data/examples/{pure → passing}/custom_formatter.rb +1 -1
- data/examples/{pure → passing}/dynamic_spec.rb +2 -2
- data/examples/{pure → passing}/file_accessor.rb +0 -0
- data/examples/{pure → passing}/file_accessor_spec.rb +0 -0
- data/examples/{pure → passing}/greeter_spec.rb +0 -0
- data/examples/{pure → passing}/helper_method_example.rb +0 -0
- data/examples/{pure → passing}/io_processor.rb +0 -0
- data/examples/{pure → passing}/io_processor_spec.rb +0 -0
- data/examples/{pure → passing}/legacy_spec.rb +0 -0
- data/examples/{pure → passing}/mocking_example.rb +0 -0
- data/examples/{pure/multi_threaded_behaviour_runner.rb → passing/multi_threaded_example_group_runner.rb} +1 -3
- data/examples/{pure → passing}/nested_classes_example.rb +0 -0
- data/examples/{pure → passing}/partial_mock_example.rb +0 -0
- data/examples/{pure → passing}/pending_example.rb +0 -0
- data/examples/{pure → passing}/predicate_example.rb +0 -0
- data/examples/{pure → passing}/priority.txt +0 -0
- data/examples/{pure → passing}/shared_example_group_example.rb +0 -0
- data/examples/{pure → passing}/shared_stack_examples.rb +1 -3
- data/examples/passing/simple_matcher_example.rb +31 -0
- data/examples/{pure → passing}/spec_helper.rb +0 -0
- data/examples/{pure → passing}/stack.rb +0 -0
- data/examples/{pure → passing}/stack_spec.rb +3 -2
- data/examples/{pure → passing}/stack_spec_with_nested_example_groups.rb +0 -0
- data/examples/{pure → passing}/stubbing_example.rb +0 -0
- data/examples/{pure → passing}/yielding_example.rb +0 -0
- data/examples/ruby1.9.compatibility/access_to_constants_spec.rb +86 -0
- data/features/before_and_after_blocks/before_and_after_blocks.feature +168 -0
- data/{stories/example_groups/autogenerated_docstrings → features/example_groups/autogenerated_docstrings.feature} +5 -5
- data/{stories/example_groups/example_group_with_should_methods → features/example_groups/example_group_with_should_methods.feature} +3 -3
- data/{stories/example_groups/nested_groups → features/example_groups/nested_groups.feature} +4 -4
- data/{stories/example_groups/output → features/example_groups/output.feature} +3 -8
- data/{stories/interop/examples_and_tests_together → features/interop/examples_and_tests_together.feature} +5 -4
- data/features/interop/test_but_not_test_unit.feature +14 -0
- data/{stories/interop/test_case_with_should_methods → features/interop/test_case_with_should_methods.feature} +2 -2
- data/{stories/mock_framework_integration/use_flexmock.story → features/mock_framework_integration/use_flexmock.feature} +1 -1
- data/features/step_definitions/running_rspec.rb +54 -0
- data/features/support/env.rb +26 -0
- data/{stories/resources → features/support}/helpers/cmdline.rb +0 -0
- data/{stories/resources → features/support}/helpers/story_helper.rb +1 -1
- data/{stories/resources → features/support}/matchers/smart_match.rb +0 -0
- data/{plugins → lib/adapters}/mock_frameworks/flexmock.rb +1 -1
- data/{plugins → lib/adapters}/mock_frameworks/mocha.rb +1 -1
- data/{plugins → lib/adapters}/mock_frameworks/rr.rb +1 -1
- data/{plugins → lib/adapters}/mock_frameworks/rspec.rb +2 -2
- data/lib/autotest/rspec.rb +4 -3
- data/lib/spec.rb +2 -27
- data/lib/spec/dsl.rb +1 -0
- data/lib/spec/{extensions → dsl}/main.rb +10 -10
- data/lib/spec/example.rb +175 -1
- data/lib/spec/example/before_and_after_hooks.rb +30 -24
- data/lib/spec/example/example_group.rb +1 -0
- data/lib/spec/example/example_group_factory.rb +26 -9
- data/lib/spec/example/example_group_methods.rb +138 -113
- data/lib/spec/example/example_methods.rb +88 -25
- data/lib/spec/example/shared_example_group.rb +28 -21
- data/lib/spec/expectations.rb +22 -18
- data/lib/spec/expectations/handler.rb +16 -36
- data/lib/spec/interop/test/unit/testcase.rb +19 -17
- data/lib/spec/interop/test/unit/testresult.rb +1 -1
- data/lib/spec/interop/test/unit/testsuite_adapter.rb +1 -1
- data/lib/spec/matchers.rb +7 -28
- data/lib/spec/matchers/be.rb +103 -116
- data/lib/spec/matchers/be_close.rb +6 -22
- data/lib/spec/matchers/eql.rb +7 -25
- data/lib/spec/matchers/equal.rb +7 -25
- data/lib/spec/matchers/errors.rb +5 -0
- data/lib/spec/matchers/exist.rb +8 -14
- data/lib/spec/matchers/generated_descriptions.rb +48 -0
- data/lib/spec/matchers/has.rb +12 -28
- data/lib/spec/matchers/include.rb +12 -9
- data/lib/spec/matchers/match.rb +8 -27
- data/lib/spec/matchers/match_array.rb +79 -0
- data/lib/spec/matchers/method_missing.rb +9 -0
- data/lib/spec/matchers/operator_matcher.rb +39 -48
- data/lib/spec/matchers/raise_error.rb +4 -8
- data/lib/spec/matchers/respond_to.rb +33 -8
- data/lib/spec/matchers/throw_symbol.rb +49 -17
- data/lib/spec/matchers/wrap_expectation.rb +55 -0
- data/lib/spec/mocks/argument_constraints.rb +77 -5
- data/lib/spec/mocks/message_expectation.rb +7 -7
- data/lib/spec/mocks/proxy.rb +14 -12
- data/lib/spec/rake/spectask.rb +4 -6
- data/lib/spec/ruby.rb +9 -0
- data/lib/spec/runner.rb +37 -162
- data/lib/spec/runner/backtrace_tweaker.rb +5 -3
- data/lib/spec/runner/class_and_arguments_parser.rb +7 -9
- data/lib/spec/runner/command_line.rb +6 -8
- data/lib/spec/{example → runner}/configuration.rb +46 -47
- data/lib/spec/runner/example_group_runner.rb +15 -4
- data/lib/spec/runner/formatter/base_text_formatter.rb +4 -3
- data/lib/spec/runner/formatter/html_formatter.rb +14 -11
- data/lib/spec/runner/formatter/nested_text_formatter.rb +2 -2
- data/lib/spec/runner/heckle_runner.rb +58 -56
- data/lib/spec/runner/option_parser.rb +8 -4
- data/lib/spec/runner/options.rb +29 -14
- data/lib/spec/runner/reporter.rb +1 -1
- data/lib/spec/runner/spec_parser.rb +11 -9
- data/lib/spec/story/runner.rb +40 -42
- data/lib/spec/story/runner/story_runner.rb +10 -6
- data/lib/spec/story/world.rb +66 -70
- data/lib/spec/version.rb +4 -2
- data/{rake_tasks → resources/rake}/examples.rake +0 -0
- data/{rake_tasks → resources/rake}/examples_with_rcov.rake +0 -0
- data/{rake_tasks → resources/rake}/failing_examples_with_html.rake +0 -0
- data/{rake_tasks → resources/rake}/verify_rcov.rake +0 -0
- data/{stories/resources → resources}/spec/example_group_with_should_methods.rb +1 -1
- data/{stories/resources → resources}/spec/simple_spec.rb +1 -1
- data/resources/spec/spec_with_flexmock.rb +19 -0
- data/{stories/resources → resources}/test/spec_and_test_together.rb +1 -1
- data/resources/test/spec_including_test_but_not_unit.rb +11 -0
- data/{stories/resources → resources}/test/test_case_with_should_methods.rb +2 -2
- data/rspec.gemspec +16 -6
- data/spec/autotest/autotest_helper.rb +2 -2
- data/spec/autotest/discover_spec.rb +4 -15
- data/spec/autotest/failed_results_re_spec.rb +24 -0
- data/spec/autotest/rspec_spec.rb +2 -38
- data/spec/spec/dsl/main_spec.rb +88 -0
- data/spec/spec/example/example_group_class_definition_spec.rb +6 -2
- data/spec/spec/example/example_group_factory_spec.rb +50 -10
- data/spec/spec/example/example_group_methods_spec.rb +210 -160
- data/spec/spec/example/example_group_spec.rb +44 -52
- data/spec/spec/example/example_matcher_spec.rb +6 -23
- data/spec/spec/example/example_methods_spec.rb +176 -54
- data/spec/spec/example/helper_method_spec.rb +24 -0
- data/spec/spec/example/pending_module_spec.rb +2 -8
- data/spec/spec/example/shared_example_group_spec.rb +56 -80
- data/spec/spec/expectations/extensions/object_spec.rb +0 -50
- data/spec/spec/expectations/wrap_expectation_spec.rb +30 -0
- data/spec/spec/interop/test/unit/spec_spec.rb +1 -5
- data/spec/spec/interop/test/unit/test_unit_spec_helper.rb +4 -0
- data/spec/spec/matchers/be_close_spec.rb +12 -10
- data/spec/spec/matchers/be_spec.rb +62 -7
- data/spec/spec/matchers/description_generation_spec.rb +19 -0
- data/spec/spec/matchers/eql_spec.rb +7 -6
- data/spec/spec/matchers/equal_spec.rb +7 -6
- data/spec/spec/matchers/handler_spec.rb +4 -43
- data/spec/spec/matchers/has_spec.rb +1 -1
- data/spec/spec/matchers/have_spec.rb +23 -18
- data/spec/spec/matchers/include_spec.rb +24 -0
- data/spec/spec/matchers/match_array_spec.rb +83 -0
- data/spec/spec/matchers/matcher_methods_spec.rb +1 -13
- data/spec/spec/matchers/raise_error_spec.rb +18 -0
- data/spec/spec/matchers/respond_to_spec.rb +71 -9
- data/spec/spec/matchers/throw_symbol_spec.rb +85 -43
- data/spec/spec/mocks/bug_report_11545_spec.rb +4 -5
- data/spec/spec/mocks/bug_report_496.rb +11 -9
- data/spec/spec/mocks/bug_report_600_spec.rb +22 -0
- data/spec/spec/mocks/hash_including_matcher_spec.rb +39 -2
- data/spec/spec/mocks/hash_not_including_matcher_spec.rb +67 -0
- data/spec/spec/mocks/mock_spec.rb +5 -6
- data/spec/spec/mocks/nil_expectation_warning_spec.rb +2 -2
- data/spec/spec/mocks/passing_mock_argument_constraints_spec.rb +18 -3
- data/spec/spec/mocks/stub_spec.rb +6 -0
- data/spec/spec/mocks/stubbed_message_expectations_spec.rb +14 -0
- data/spec/spec/runner/command_line_spec.rb +4 -4
- data/spec/spec/runner/configuration_spec.rb +301 -0
- data/spec/spec/runner/drb_command_line_spec.rb +4 -4
- data/spec/spec/runner/example_group_runner_spec.rb +33 -0
- data/spec/spec/runner/formatter/base_formatter_spec.rb +13 -102
- data/spec/spec/runner/formatter/base_text_formatter_spec.rb +23 -0
- data/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +5 -5
- data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +3 -3
- data/spec/spec/runner/formatter/html_formatted-1.8.4.html +6 -6
- data/spec/spec/runner/formatter/html_formatted-1.8.5-jruby.html +9 -9
- data/spec/spec/runner/formatter/html_formatted-1.8.5.html +6 -6
- data/spec/spec/runner/formatter/html_formatted-1.8.6-jruby.html +10 -10
- data/spec/spec/runner/formatter/html_formatted-1.8.6.html +39 -30
- data/spec/spec/runner/formatter/html_formatted-1.8.7.html +379 -0
- data/spec/spec/runner/formatter/html_formatted-1.9.1.html +379 -0
- data/spec/spec/runner/formatter/html_formatter_spec.rb +14 -13
- data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +5 -5
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +7 -17
- data/spec/spec/runner/formatter/spec_mate_formatter_spec.rb +18 -17
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +5 -5
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.4.html +6 -6
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +33 -30
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.7.html +373 -0
- data/spec/spec/runner/formatter/text_mate_formatted-1.9.1.html +373 -0
- data/spec/spec/runner/heckler_spec.rb +16 -9
- data/spec/spec/runner/option_parser_spec.rb +3 -18
- data/spec/spec/runner/options_spec.rb +27 -8
- data/spec/spec/runner/reporter_spec.rb +5 -5
- data/spec/spec/runner/resources/custom_example_group_runner.rb +14 -0
- data/spec/spec/runner/resources/utf8_encoded.rb +7 -0
- data/spec/spec/runner/spec_parser_spec.rb +85 -79
- data/spec/spec/spec_spec.rb +21 -0
- data/spec/spec_helper.rb +9 -1
- data/story_server/prototype/javascripts/prototype.js +1 -1
- metadata +119 -131
- data/examples/stories/adder.rb +0 -13
- data/examples/stories/addition +0 -34
- data/examples/stories/addition.rb +0 -9
- data/examples/stories/calculator.rb +0 -65
- data/examples/stories/game-of-life/.loadpath +0 -5
- data/examples/stories/game-of-life/README.txt +0 -21
- data/examples/stories/game-of-life/behaviour/everything.rb +0 -6
- data/examples/stories/game-of-life/behaviour/examples/examples.rb +0 -3
- data/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb +0 -35
- data/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb +0 -66
- data/examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story +0 -21
- data/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story +0 -21
- data/examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story +0 -42
- data/examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story +0 -42
- data/examples/stories/game-of-life/behaviour/stories/ICanKillACell.story +0 -17
- data/examples/stories/game-of-life/behaviour/stories/TheGridWraps.story +0 -53
- data/examples/stories/game-of-life/behaviour/stories/create_a_cell.rb +0 -52
- data/examples/stories/game-of-life/behaviour/stories/helper.rb +0 -6
- data/examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb +0 -26
- data/examples/stories/game-of-life/behaviour/stories/steps.rb +0 -5
- data/examples/stories/game-of-life/behaviour/stories/stories.rb +0 -3
- data/examples/stories/game-of-life/behaviour/stories/stories.txt +0 -22
- data/examples/stories/game-of-life/life.rb +0 -3
- data/examples/stories/game-of-life/life/game.rb +0 -23
- data/examples/stories/game-of-life/life/grid.rb +0 -43
- data/examples/stories/helper.rb +0 -9
- data/examples/stories/steps/addition_steps.rb +0 -18
- data/lib/spec/adapters.rb +0 -1
- data/lib/spec/adapters/ruby_engine.rb +0 -26
- data/lib/spec/adapters/ruby_engine/mri.rb +0 -8
- data/lib/spec/adapters/ruby_engine/rubinius.rb +0 -8
- data/lib/spec/extensions.rb +0 -4
- data/lib/spec/extensions/class.rb +0 -24
- data/lib/spec/extensions/metaclass.rb +0 -7
- data/lib/spec/extensions/object.rb +0 -6
- data/spec/spec/adapters/ruby_engine_spec.rb +0 -16
- data/spec/spec/example/configuration_spec.rb +0 -296
- data/spec/spec/example/example_runner_spec.rb +0 -194
- data/spec/spec/extensions/main_spec.rb +0 -71
- data/stories/all.rb +0 -5
- data/stories/configuration/before_blocks.story +0 -21
- data/stories/configuration/stories.rb +0 -7
- data/stories/example_groups/stories.rb +0 -7
- data/stories/helper.rb +0 -6
- data/stories/interop/stories.rb +0 -7
- data/stories/mock_framework_integration/stories.rb +0 -7
- data/stories/pending_stories/README +0 -3
- data/stories/resources/spec/before_blocks_example.rb +0 -32
- data/stories/resources/spec/spec_with_flexmock.rb +0 -18
- data/stories/resources/steps/running_rspec.rb +0 -50
- data/stories/resources/stories/failing_story.rb +0 -15
- data/stories/stories/multiline_steps.story +0 -23
- data/stories/stories/steps/multiline_steps.rb +0 -13
- data/stories/stories/stories.rb +0 -6
| @@ -1,194 +0,0 @@ | |
| 1 | 
            -
            require File.dirname(__FILE__) + '/../../spec_helper.rb'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Spec
         | 
| 4 | 
            -
              module Example
         | 
| 5 | 
            -
                # describe "Spec::Example::ExampleRunner", "#run", :shared => true do
         | 
| 6 | 
            -
                #   before(:each) do
         | 
| 7 | 
            -
                #     @options = ::Spec::Runner::Options.new(StringIO.new, StringIO.new)
         | 
| 8 | 
            -
                #     @reporter = ::Spec::Runner::Reporter.new(@options)
         | 
| 9 | 
            -
                #     @options.reporter = @reporter
         | 
| 10 | 
            -
                #     @example_group_class = Class.new(ExampleGroup) do
         | 
| 11 | 
            -
                #       plugin_mock_framework
         | 
| 12 | 
            -
                #       describe("Some Examples")
         | 
| 13 | 
            -
                #     end
         | 
| 14 | 
            -
                #   end
         | 
| 15 | 
            -
                # 
         | 
| 16 | 
            -
                #   def create_runner(example_definition)
         | 
| 17 | 
            -
                #     example = @example_group_class.new(example_definition)
         | 
| 18 | 
            -
                #     runner = ExampleGroup.new(@options, example)
         | 
| 19 | 
            -
                #     runner.stub!(:verify_mocks)
         | 
| 20 | 
            -
                #     runner.stub!(:teardown_mocks)
         | 
| 21 | 
            -
                #     runner
         | 
| 22 | 
            -
                #   end
         | 
| 23 | 
            -
                # end
         | 
| 24 | 
            -
                # 
         | 
| 25 | 
            -
                # describe ExampleRunner, "#run with blank passing example" do
         | 
| 26 | 
            -
                #   it_should_behave_like "Spec::Example::ExampleRunner#run"
         | 
| 27 | 
            -
                # 
         | 
| 28 | 
            -
                #   before do
         | 
| 29 | 
            -
                #     @e = @example_group_class.it("example") {}
         | 
| 30 | 
            -
                #     @runner = create_runner(@e)
         | 
| 31 | 
            -
                #   end
         | 
| 32 | 
            -
                #   
         | 
| 33 | 
            -
                #   it "should send reporter example_started" do
         | 
| 34 | 
            -
                #     @reporter.should_receive(:example_started).with(equal(@e))
         | 
| 35 | 
            -
                #     @runner.run
         | 
| 36 | 
            -
                #   end
         | 
| 37 | 
            -
                # 
         | 
| 38 | 
            -
                #   it "should report its name for dry run" do
         | 
| 39 | 
            -
                #     @options.dry_run = true
         | 
| 40 | 
            -
                #     @reporter.should_receive(:example_finished).with(equal(@e), nil)
         | 
| 41 | 
            -
                #     @runner.run
         | 
| 42 | 
            -
                #   end
         | 
| 43 | 
            -
                # 
         | 
| 44 | 
            -
                #   it "should report success" do
         | 
| 45 | 
            -
                #     @reporter.should_receive(:example_finished).with(equal(@e), nil)
         | 
| 46 | 
            -
                #     @runner.run
         | 
| 47 | 
            -
                #   end
         | 
| 48 | 
            -
                # end
         | 
| 49 | 
            -
                # 
         | 
| 50 | 
            -
                # describe ExampleRunner, "#run with a failing example" do
         | 
| 51 | 
            -
                #   predicate_matchers[:is_a] = [:is_a?]
         | 
| 52 | 
            -
                #   it_should_behave_like "Spec::Example::ExampleRunner#run"
         | 
| 53 | 
            -
                # 
         | 
| 54 | 
            -
                #   before do
         | 
| 55 | 
            -
                #     @e = @example_group_class.it("example") do
         | 
| 56 | 
            -
                #       (2+2).should == 5
         | 
| 57 | 
            -
                #     end
         | 
| 58 | 
            -
                #     @runner = create_runner(@e)
         | 
| 59 | 
            -
                #   end
         | 
| 60 | 
            -
                # 
         | 
| 61 | 
            -
                #   it "should report failure due to failure" do
         | 
| 62 | 
            -
                #     @reporter.should_receive(:example_finished).with(
         | 
| 63 | 
            -
                #       equal(@e),
         | 
| 64 | 
            -
                #       is_a(Spec::Expectations::ExpectationNotMetError)
         | 
| 65 | 
            -
                #     )
         | 
| 66 | 
            -
                #     @runner.run
         | 
| 67 | 
            -
                #   end
         | 
| 68 | 
            -
                # end
         | 
| 69 | 
            -
                # 
         | 
| 70 | 
            -
                # describe ExampleRunner, "#run with a erroring example" do
         | 
| 71 | 
            -
                #   it_should_behave_like "Spec::Example::ExampleRunner#run"
         | 
| 72 | 
            -
                # 
         | 
| 73 | 
            -
                #   before do
         | 
| 74 | 
            -
                #     @error = error = NonStandardError.new("in body")
         | 
| 75 | 
            -
                #     @example_definition = @example_group_class.it("example") do
         | 
| 76 | 
            -
                #       raise(error)
         | 
| 77 | 
            -
                #     end
         | 
| 78 | 
            -
                #     @runner = create_runner(@example_definition)
         | 
| 79 | 
            -
                #   end
         | 
| 80 | 
            -
                # 
         | 
| 81 | 
            -
                #   it "should report failure due to error" do
         | 
| 82 | 
            -
                #     @reporter.should_receive(:example_finished).with(
         | 
| 83 | 
            -
                #       equal(@example_definition),
         | 
| 84 | 
            -
                #       @error
         | 
| 85 | 
            -
                #     )
         | 
| 86 | 
            -
                #     @runner.run
         | 
| 87 | 
            -
                #   end
         | 
| 88 | 
            -
                # 
         | 
| 89 | 
            -
                #   it "should run after_each block" do
         | 
| 90 | 
            -
                #     @example_group_class.after(:each) do
         | 
| 91 | 
            -
                #       raise("in after_each")
         | 
| 92 | 
            -
                #     end
         | 
| 93 | 
            -
                #     @reporter.should_receive(:example_finished) do |example_definition, error|
         | 
| 94 | 
            -
                #       example_definition.should equal(@example_definition)
         | 
| 95 | 
            -
                #       error.message.should eql("in body")
         | 
| 96 | 
            -
                #     end
         | 
| 97 | 
            -
                #     @runner.run
         | 
| 98 | 
            -
                #   end      
         | 
| 99 | 
            -
                # end
         | 
| 100 | 
            -
                # 
         | 
| 101 | 
            -
                # describe ExampleRunner, "#run where after_each fails" do
         | 
| 102 | 
            -
                #   it_should_behave_like "Spec::Example::ExampleRunner#run"
         | 
| 103 | 
            -
                # 
         | 
| 104 | 
            -
                #   before do
         | 
| 105 | 
            -
                #     @example_ran = example_ran = false
         | 
| 106 | 
            -
                #     @example_definition = @example_group_class.it("should not run") do
         | 
| 107 | 
            -
                #       example_ran = true
         | 
| 108 | 
            -
                #     end
         | 
| 109 | 
            -
                #     @runner = create_runner(@example_definition)
         | 
| 110 | 
            -
                #     @example_group_class.after(:each) { raise(NonStandardError.new("in after_each")) }
         | 
| 111 | 
            -
                #   end
         | 
| 112 | 
            -
                # 
         | 
| 113 | 
            -
                #   it "should report failure location when in after_each" do
         | 
| 114 | 
            -
                #     @reporter.should_receive(:example_finished) do |example_definition, error|
         | 
| 115 | 
            -
                #       example_definition.should equal(@example_definition)
         | 
| 116 | 
            -
                #       error.message.should eql("in after_each")
         | 
| 117 | 
            -
                #     end
         | 
| 118 | 
            -
                #     @runner.run
         | 
| 119 | 
            -
                #   end
         | 
| 120 | 
            -
                # end
         | 
| 121 | 
            -
                # 
         | 
| 122 | 
            -
                # describe ExampleRunner, "#run with use cases" do
         | 
| 123 | 
            -
                #   predicate_matchers[:is_a] = [:is_a?]
         | 
| 124 | 
            -
                #   it_should_behave_like "Spec::Example::ExampleRunner#run"
         | 
| 125 | 
            -
                # 
         | 
| 126 | 
            -
                #   it "should report NO NAME when told to use generated description with --dry-run" do
         | 
| 127 | 
            -
                #     @options.dry_run = true
         | 
| 128 | 
            -
                #     example_definition = @example_group_class.it() do
         | 
| 129 | 
            -
                #       5.should == 5
         | 
| 130 | 
            -
                #     end
         | 
| 131 | 
            -
                #     runner = create_runner(example_definition)
         | 
| 132 | 
            -
                # 
         | 
| 133 | 
            -
                #     @reporter.should_receive(:example_finished) do |example_definition, error|
         | 
| 134 | 
            -
                #       example_definition.description.should == "NO NAME (Because of --dry-run)"
         | 
| 135 | 
            -
                #      end
         | 
| 136 | 
            -
                #     runner.run
         | 
| 137 | 
            -
                #   end
         | 
| 138 | 
            -
                # 
         | 
| 139 | 
            -
                #   it "should report given name if present with --dry-run" do
         | 
| 140 | 
            -
                #     @options.dry_run = true
         | 
| 141 | 
            -
                #     example_definition = @example_group_class.it("example name") do
         | 
| 142 | 
            -
                #       5.should == 5
         | 
| 143 | 
            -
                #     end
         | 
| 144 | 
            -
                #     runner = create_runner(example_definition)
         | 
| 145 | 
            -
                # 
         | 
| 146 | 
            -
                #     @reporter.should_receive(:example_finished) do |example_definition, error|
         | 
| 147 | 
            -
                #       example_definition.description.should == "example name"
         | 
| 148 | 
            -
                #      end
         | 
| 149 | 
            -
                #     runner.run
         | 
| 150 | 
            -
                #   end
         | 
| 151 | 
            -
                # 
         | 
| 152 | 
            -
                #   it "should report NO NAME when told to use generated description with no expectations" do
         | 
| 153 | 
            -
                #     example_definition = @example_group_class.it() {}
         | 
| 154 | 
            -
                #     runner = create_runner(example_definition)
         | 
| 155 | 
            -
                #     @reporter.should_receive(:example_finished) do |example, error|
         | 
| 156 | 
            -
                #       example.description.should == "NO NAME (Because there were no expectations)"
         | 
| 157 | 
            -
                #     end
         | 
| 158 | 
            -
                #     runner.run
         | 
| 159 | 
            -
                #   end
         | 
| 160 | 
            -
                # 
         | 
| 161 | 
            -
                #   it "should report NO NAME when told to use generated description and matcher fails" do
         | 
| 162 | 
            -
                #     example_definition = @example_group_class.it() do
         | 
| 163 | 
            -
                #       5.should "" # Has no matches? method..
         | 
| 164 | 
            -
                #     end
         | 
| 165 | 
            -
                #     runner = create_runner(example_definition)
         | 
| 166 | 
            -
                # 
         | 
| 167 | 
            -
                #     @reporter.should_receive(:example_finished) do |example, error|
         | 
| 168 | 
            -
                #       example_definition.description.should == "NO NAME (Because of Error raised in matcher)"
         | 
| 169 | 
            -
                #     end
         | 
| 170 | 
            -
                #     runner.run
         | 
| 171 | 
            -
                #   end
         | 
| 172 | 
            -
                # 
         | 
| 173 | 
            -
                #   it "should report generated description when told to and it is available" do
         | 
| 174 | 
            -
                #     example_definition = @example_group_class.it() {
         | 
| 175 | 
            -
                #       5.should == 5
         | 
| 176 | 
            -
                #     }
         | 
| 177 | 
            -
                #     runner = create_runner(example_definition)
         | 
| 178 | 
            -
                #     
         | 
| 179 | 
            -
                #     @reporter.should_receive(:example_finished) do |example_definition, error|
         | 
| 180 | 
            -
                #       example_definition.description.should == "should == 5"
         | 
| 181 | 
            -
                #     end
         | 
| 182 | 
            -
                #     runner.run
         | 
| 183 | 
            -
                #   end
         | 
| 184 | 
            -
                # 
         | 
| 185 | 
            -
                #   it "should unregister description_generated callback (lest a memory leak should build up)" do
         | 
| 186 | 
            -
                #     example_definition = @example_group_class.it("something")
         | 
| 187 | 
            -
                #     runner = create_runner(example_definition)
         | 
| 188 | 
            -
                # 
         | 
| 189 | 
            -
                #     Spec::Matchers.should_receive(:example_finished)
         | 
| 190 | 
            -
                #     runner.run
         | 
| 191 | 
            -
                #   end
         | 
| 192 | 
            -
                # end
         | 
| 193 | 
            -
              end
         | 
| 194 | 
            -
            end
         | 
| @@ -1,71 +0,0 @@ | |
| 1 | 
            -
            require File.dirname(__FILE__) + '/../../spec_helper.rb'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Spec
         | 
| 4 | 
            -
              module Extensions
         | 
| 5 | 
            -
                describe Main do
         | 
| 6 | 
            -
                  before(:each) do
         | 
| 7 | 
            -
                    @main = Class.new do; include Main; end
         | 
| 8 | 
            -
                  end
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                  after(:each) do
         | 
| 11 | 
            -
                    $rspec_story_steps = @original_rspec_story_steps
         | 
| 12 | 
            -
                  end
         | 
| 13 | 
            -
                  
         | 
| 14 | 
            -
                  [:describe, :context].each do |method|
         | 
| 15 | 
            -
                    describe "##{method}" do
         | 
| 16 | 
            -
                      specify {@main.should respond_to(method)}
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                      it "should raise when no block is given to #{method}" do
         | 
| 19 | 
            -
                        lambda { @main.__send__ method, "foo" }.should raise_error(ArgumentError)
         | 
| 20 | 
            -
                      end
         | 
| 21 | 
            -
             | 
| 22 | 
            -
                      it "should raise when no description is given to #{method}" do
         | 
| 23 | 
            -
                        lambda { @main.__send__ method do; end }.should raise_error(ArgumentError)
         | 
| 24 | 
            -
                      end
         | 
| 25 | 
            -
             | 
| 26 | 
            -
                      it "should run registered ExampleGroups" do
         | 
| 27 | 
            -
                        example_group = @main.__send__ method, "The ExampleGroup" do end
         | 
| 28 | 
            -
                        Spec::Runner.options.example_groups.should include(example_group)
         | 
| 29 | 
            -
                      end
         | 
| 30 | 
            -
             | 
| 31 | 
            -
                      it "should not run unregistered ExampleGroups" do
         | 
| 32 | 
            -
                        example_group = @main.__send__ method, "The ExampleGroup" do unregister; end
         | 
| 33 | 
            -
                        Spec::Runner.options.example_groups.should_not include(example_group)
         | 
| 34 | 
            -
                      end
         | 
| 35 | 
            -
                    end
         | 
| 36 | 
            -
                  end
         | 
| 37 | 
            -
                  
         | 
| 38 | 
            -
                  describe "#share_examples_for" do
         | 
| 39 | 
            -
                    it "should create a shared ExampleGroup" do
         | 
| 40 | 
            -
                      group = @main.share_examples_for "all things" do end
         | 
| 41 | 
            -
                      group.should be_an_instance_of(Spec::Example::SharedExampleGroup)
         | 
| 42 | 
            -
                    end
         | 
| 43 | 
            -
                  end
         | 
| 44 | 
            -
                  
         | 
| 45 | 
            -
                  describe "#share_as" do
         | 
| 46 | 
            -
                    before(:each) do
         | 
| 47 | 
            -
                      $share_as_examples_example_module_number ||= 1
         | 
| 48 | 
            -
                      $share_as_examples_example_module_number += 1
         | 
| 49 | 
            -
                      @group_name = "Group#{$share_as_examples_example_module_number}"
         | 
| 50 | 
            -
                    end
         | 
| 51 | 
            -
             | 
| 52 | 
            -
                    it "should create a shared ExampleGroup" do
         | 
| 53 | 
            -
                      group = @main.share_as @group_name do end
         | 
| 54 | 
            -
                      group.should be_an_instance_of(Spec::Example::SharedExampleGroup)
         | 
| 55 | 
            -
                    end
         | 
| 56 | 
            -
                    
         | 
| 57 | 
            -
                    it "should create a constant that points to a Module" do
         | 
| 58 | 
            -
                      group = @main.share_as @group_name do end
         | 
| 59 | 
            -
                      Object.const_get(@group_name).should equal(group)
         | 
| 60 | 
            -
                    end
         | 
| 61 | 
            -
                    
         | 
| 62 | 
            -
                    it "should bark if you pass it something not-constantizable" do
         | 
| 63 | 
            -
                      lambda do
         | 
| 64 | 
            -
                        @group = @main.share_as "Non Constant" do end
         | 
| 65 | 
            -
                      end.should raise_error(NameError, /The first argument to share_as must be a legal name for a constant/)
         | 
| 66 | 
            -
                    end
         | 
| 67 | 
            -
                    
         | 
| 68 | 
            -
                  end
         | 
| 69 | 
            -
                end
         | 
| 70 | 
            -
              end
         | 
| 71 | 
            -
            end
         | 
    
        data/stories/all.rb
    DELETED
    
    
| @@ -1,21 +0,0 @@ | |
| 1 | 
            -
            Story: before suite
         | 
| 2 | 
            -
            	As a developer using rspec
         | 
| 3 | 
            -
            	I want to define before blocks in the global configuration
         | 
| 4 | 
            -
            	So that I can define global things globally
         | 
| 5 | 
            -
            	
         | 
| 6 | 
            -
            	Scenario: running with ruby
         | 
| 7 | 
            -
            	
         | 
| 8 | 
            -
            		Given the file ../resources/spec/before_blocks_example.rb
         | 
| 9 | 
            -
            		
         | 
| 10 | 
            -
                When I run it with the ruby interpreter
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            		Then the stdout should match "3 examples, 0 failures"
         | 
| 13 | 
            -
            		
         | 
| 14 | 
            -
            	Scenario: running with spec
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            		Given the file ../resources/spec/before_blocks_example.rb
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                When I run it with the spec script
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            		Then the stdout should match "3 examples, 0 failures"
         | 
| 21 | 
            -
            					
         | 
    
        data/stories/helper.rb
    DELETED
    
    | @@ -1,6 +0,0 @@ | |
| 1 | 
            -
            $LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib")
         | 
| 2 | 
            -
            require 'spec'
         | 
| 3 | 
            -
            require 'tempfile'
         | 
| 4 | 
            -
            require File.join(File.dirname(__FILE__), *%w[resources matchers smart_match])
         | 
| 5 | 
            -
            require File.join(File.dirname(__FILE__), *%w[resources helpers story_helper])
         | 
| 6 | 
            -
            require File.join(File.dirname(__FILE__), *%w[resources steps running_rspec])
         | 
    
        data/stories/interop/stories.rb
    DELETED
    
    
| @@ -1,32 +0,0 @@ | |
| 1 | 
            -
            $:.unshift File.join(File.dirname(__FILE__), *%w[.. .. .. lib])
         | 
| 2 | 
            -
            require 'spec'
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            Spec::Runner.configure do |config|
         | 
| 5 | 
            -
              config.before(:suite) do
         | 
| 6 | 
            -
                $before_suite = "before suite"
         | 
| 7 | 
            -
              end
         | 
| 8 | 
            -
              config.before(:each) do
         | 
| 9 | 
            -
                @before_each = "before each"
         | 
| 10 | 
            -
              end
         | 
| 11 | 
            -
              config.before(:all) do
         | 
| 12 | 
            -
                @before_all = "before all"
         | 
| 13 | 
            -
              end
         | 
| 14 | 
            -
            end
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            describe "stuff in before blocks" do
         | 
| 17 | 
            -
              describe "with :suite" do
         | 
| 18 | 
            -
                it "should be available in the example" do
         | 
| 19 | 
            -
                  $before_suite.should == "before suite"
         | 
| 20 | 
            -
                end
         | 
| 21 | 
            -
              end
         | 
| 22 | 
            -
              describe "with :all" do
         | 
| 23 | 
            -
                it "should be available in the example" do
         | 
| 24 | 
            -
                  @before_all.should == "before all"
         | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
              end
         | 
| 27 | 
            -
              describe "with :each" do
         | 
| 28 | 
            -
                it "should be available in the example" do
         | 
| 29 | 
            -
                  @before_each.should == "before each"
         | 
| 30 | 
            -
                end
         | 
| 31 | 
            -
              end
         | 
| 32 | 
            -
            end
         | 
| @@ -1,18 +0,0 @@ | |
| 1 | 
            -
            $:.push File.join(File.dirname(__FILE__), *%w[.. .. .. lib])
         | 
| 2 | 
            -
            require "rubygems"
         | 
| 3 | 
            -
            require 'spec'
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            Spec::Runner.configure do |config|
         | 
| 6 | 
            -
              config.mock_with :flexmock
         | 
| 7 | 
            -
            end
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            # This is to ensure that requiring spec/mocks/framework doesn't interfere w/ flexmock
         | 
| 10 | 
            -
            require 'spec/mocks/framework'
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            describe "something" do
         | 
| 13 | 
            -
              it "should receive some message" do
         | 
| 14 | 
            -
                target = Object.new
         | 
| 15 | 
            -
                flexmock(target).should_receive(:foo).once
         | 
| 16 | 
            -
                lambda {flexmock_verify}.should raise_error
         | 
| 17 | 
            -
              end
         | 
| 18 | 
            -
            end
         | 
| @@ -1,50 +0,0 @@ | |
| 1 | 
            -
            steps_for :running_rspec do
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              Given("the file $relative_path") do |relative_path|
         | 
| 4 | 
            -
                @path = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "resources", relative_path))
         | 
| 5 | 
            -
                unless File.exist?(@path)
         | 
| 6 | 
            -
                  raise "could not find file at #{@path}"
         | 
| 7 | 
            -
                end
         | 
| 8 | 
            -
              end
         | 
| 9 | 
            -
              
         | 
| 10 | 
            -
              When("I run it with the $interpreter") do |interpreter|
         | 
| 11 | 
            -
                stderr_file = Tempfile.new('rspec')
         | 
| 12 | 
            -
                stderr_file.close
         | 
| 13 | 
            -
                @stdout = case(interpreter)
         | 
| 14 | 
            -
                  when /^ruby interpreter/
         | 
| 15 | 
            -
                    args = interpreter.gsub('ruby interpreter','')
         | 
| 16 | 
            -
                    ruby("#{@path}#{args}", stderr_file.path)
         | 
| 17 | 
            -
                  when /^spec script/
         | 
| 18 | 
            -
                    args = interpreter.gsub('spec script','')
         | 
| 19 | 
            -
                    spec("#{@path}#{args}", stderr_file.path)
         | 
| 20 | 
            -
                  when 'CommandLine object' then cmdline(@path, stderr_file.path)
         | 
| 21 | 
            -
                  else raise "Unknown interpreter: #{interpreter}"
         | 
| 22 | 
            -
                end
         | 
| 23 | 
            -
                @stderr = IO.read(stderr_file.path)
         | 
| 24 | 
            -
                @exit_code = $?.to_i
         | 
| 25 | 
            -
              end
         | 
| 26 | 
            -
              
         | 
| 27 | 
            -
              Then("the exit code should be $exit_code") do |exit_code|
         | 
| 28 | 
            -
                if @exit_code != exit_code.to_i
         | 
| 29 | 
            -
                  raise "Did not exit with #{exit_code}, but with #{@exit_code}. Standard error:\n#{@stderr}"
         | 
| 30 | 
            -
                end
         | 
| 31 | 
            -
              end
         | 
| 32 | 
            -
              
         | 
| 33 | 
            -
              Then("the $stream should match $regex") do |stream, string_or_regex|
         | 
| 34 | 
            -
                written = case(stream)
         | 
| 35 | 
            -
                  when 'stdout' then @stdout
         | 
| 36 | 
            -
                  when 'stderr' then @stderr
         | 
| 37 | 
            -
                  else raise "Unknown stream: #{stream}"
         | 
| 38 | 
            -
                end
         | 
| 39 | 
            -
                written.should smart_match(string_or_regex)
         | 
| 40 | 
            -
              end
         | 
| 41 | 
            -
              
         | 
| 42 | 
            -
              Then("the $stream should not match $regex") do |stream, string_or_regex|
         | 
| 43 | 
            -
                written = case(stream)
         | 
| 44 | 
            -
                  when 'stdout' then @stdout
         | 
| 45 | 
            -
                  when 'stderr' then @stderr
         | 
| 46 | 
            -
                  else raise "Unknown stream: #{stream}"
         | 
| 47 | 
            -
                end
         | 
| 48 | 
            -
                written.should_not smart_match(string_or_regex)
         | 
| 49 | 
            -
              end
         | 
| 50 | 
            -
            end
         |