rspec 1.0.8 → 1.1.0
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/CHANGES +122 -2
- data/README +10 -9
- data/Rakefile +22 -49
- data/TODO +2 -0
- data/bin/spec +1 -1
- data/bin/spec_translator +8 -8
- data/examples/{auto_spec_description_example.rb → pure/autogenerated_docstrings_example.rb} +0 -0
- data/examples/{before_and_after_example.rb → pure/before_and_after_example.rb} +1 -0
- data/examples/{behave_as_example.rb → pure/behave_as_example.rb} +0 -0
- data/examples/{custom_expectation_matchers.rb → pure/custom_expectation_matchers.rb} +0 -0
- data/examples/{custom_formatter.rb → pure/custom_formatter.rb} +1 -0
- data/examples/{dynamic_spec.rb → pure/dynamic_spec.rb} +0 -0
- data/examples/{file_accessor.rb → pure/file_accessor.rb} +1 -0
- data/examples/{file_accessor_spec.rb → pure/file_accessor_spec.rb} +0 -0
- data/examples/{greeter_spec.rb → pure/greeter_spec.rb} +1 -0
- data/examples/{helper_method_example.rb → pure/helper_method_example.rb} +0 -0
- data/examples/{io_processor.rb → pure/io_processor.rb} +0 -0
- data/examples/{io_processor_spec.rb → pure/io_processor_spec.rb} +0 -0
- data/examples/{legacy_spec.rb → pure/legacy_spec.rb} +1 -0
- data/examples/{mocking_example.rb → pure/mocking_example.rb} +0 -0
- data/examples/pure/multi_threaded_behaviour_runner.rb +28 -0
- data/examples/pure/nested_classes_example.rb +36 -0
- data/examples/{partial_mock_example.rb → pure/partial_mock_example.rb} +0 -0
- data/examples/{pending_example.rb → pure/pending_example.rb} +0 -0
- data/examples/{predicate_example.rb → pure/predicate_example.rb} +0 -0
- data/examples/{priority.txt → pure/priority.txt} +0 -0
- data/examples/pure/shared_example_group_example.rb +66 -0
- data/examples/pure/shared_stack_examples.rb +38 -0
- data/examples/pure/spec_helper.rb +3 -0
- data/examples/{stack.rb → pure/stack.rb} +0 -0
- data/examples/{stack_spec.rb → pure/stack_spec.rb} +1 -35
- data/examples/pure/stack_spec_with_nested_example_groups.rb +67 -0
- data/examples/{stubbing_example.rb → pure/stubbing_example.rb} +0 -0
- data/examples/stories/adder.rb +13 -0
- data/examples/stories/addition +34 -0
- data/examples/stories/addition.rb +9 -0
- data/examples/stories/calculator.rb +65 -0
- data/examples/stories/game-of-life/README.txt +21 -0
- data/examples/stories/game-of-life/behaviour/everything.rb +6 -0
- data/examples/stories/game-of-life/behaviour/examples/examples.rb +3 -0
- data/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb +35 -0
- data/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb +66 -0
- data/examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story +21 -0
- data/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story +21 -0
- data/examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story +42 -0
- data/examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story +42 -0
- data/examples/stories/game-of-life/behaviour/stories/ICanKillACell.story +17 -0
- data/examples/stories/game-of-life/behaviour/stories/TheGridWraps.story +53 -0
- data/examples/stories/game-of-life/behaviour/stories/create_a_cell.rb +52 -0
- data/examples/stories/game-of-life/behaviour/stories/helper.rb +6 -0
- data/examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb +26 -0
- data/examples/stories/game-of-life/behaviour/stories/steps.rb +5 -0
- data/examples/stories/game-of-life/behaviour/stories/stories.rb +3 -0
- data/examples/stories/game-of-life/behaviour/stories/stories.txt +22 -0
- data/examples/stories/game-of-life/life.rb +3 -0
- data/examples/stories/game-of-life/life/game.rb +23 -0
- data/examples/stories/game-of-life/life/grid.rb +43 -0
- data/examples/stories/helper.rb +9 -0
- data/examples/stories/steps/addition_steps.rb +18 -0
- data/lib/autotest/rspec.rb +1 -2
- data/lib/spec.rb +30 -6
- data/lib/spec/example.rb +12 -0
- data/lib/spec/{dsl → example}/configuration.rb +48 -39
- data/lib/spec/{dsl → example}/errors.rb +2 -2
- data/lib/spec/example/example_group.rb +16 -0
- data/lib/spec/example/example_group_factory.rb +62 -0
- data/lib/spec/example/example_group_methods.rb +412 -0
- data/lib/spec/example/example_matcher.rb +42 -0
- data/lib/spec/example/example_methods.rb +101 -0
- data/lib/spec/example/module_reopening_fix.rb +21 -0
- data/lib/spec/example/pending.rb +18 -0
- data/lib/spec/example/shared_example_group.rb +58 -0
- data/lib/spec/expectations/differs/default.rb +15 -10
- data/lib/spec/expectations/errors.rb +7 -1
- data/lib/spec/expectations/extensions/object.rb +12 -7
- data/lib/spec/expectations/handler.rb +13 -4
- data/lib/spec/extensions.rb +2 -0
- data/lib/spec/extensions/class.rb +24 -0
- data/lib/spec/extensions/main.rb +54 -0
- data/lib/spec/extensions/object.rb +5 -1
- data/lib/spec/interop/test.rb +10 -0
- data/lib/spec/interop/test/unit/autorunner.rb +6 -0
- data/lib/spec/interop/test/unit/testcase.rb +61 -0
- data/lib/spec/interop/test/unit/testresult.rb +6 -0
- data/lib/spec/interop/test/unit/testsuite_adapter.rb +34 -0
- data/lib/spec/interop/test/unit/ui/console/testrunner.rb +60 -0
- data/lib/spec/matchers.rb +11 -15
- data/lib/spec/matchers/be.rb +23 -6
- data/lib/spec/matchers/change.rb +25 -1
- data/lib/spec/matchers/exist.rb +17 -0
- data/lib/spec/matchers/operator_matcher.rb +1 -0
- data/lib/spec/matchers/simple_matcher.rb +29 -0
- data/lib/spec/matchers/throw_symbol.rb +2 -0
- data/lib/spec/mocks.rb +5 -2
- data/lib/spec/mocks/argument_expectation.rb +1 -1
- data/lib/spec/mocks/message_expectation.rb +62 -44
- data/lib/spec/mocks/methods.rb +2 -2
- data/lib/spec/mocks/mock.rb +24 -3
- data/lib/spec/mocks/proxy.rb +26 -23
- data/lib/spec/mocks/space.rb +1 -1
- data/lib/spec/mocks/spec_methods.rb +20 -12
- data/lib/spec/rake/spectask.rb +19 -1
- data/lib/spec/rake/verify_rcov.rb +1 -1
- data/lib/spec/runner.rb +33 -10
- data/lib/spec/runner/backtrace_tweaker.rb +3 -3
- data/lib/spec/runner/class_and_arguments_parser.rb +16 -0
- data/lib/spec/runner/command_line.rb +18 -12
- data/lib/spec/runner/drb_command_line.rb +4 -5
- data/lib/spec/runner/example_group_runner.rb +59 -0
- data/lib/spec/runner/formatter/base_formatter.rb +10 -8
- data/lib/spec/runner/formatter/base_text_formatter.rb +18 -18
- data/lib/spec/runner/formatter/failing_example_groups_formatter.rb +31 -0
- data/lib/spec/runner/formatter/failing_examples_formatter.rb +3 -5
- data/lib/spec/runner/formatter/html_formatter.rb +37 -27
- data/lib/spec/runner/formatter/profile_formatter.rb +47 -0
- data/lib/spec/runner/formatter/progress_bar_formatter.rb +3 -4
- data/lib/spec/runner/formatter/specdoc_formatter.rb +27 -13
- data/lib/spec/runner/formatter/story/html_formatter.rb +124 -0
- data/lib/spec/runner/formatter/story/plain_text_formatter.rb +123 -0
- data/lib/spec/runner/formatter/text_mate_formatter.rb +16 -0
- data/lib/spec/runner/heckle_runner.rb +9 -9
- data/lib/spec/runner/option_parser.rb +140 -138
- data/lib/spec/runner/options.rb +168 -90
- data/lib/spec/runner/reporter.rb +58 -40
- data/lib/spec/runner/spec_parser.rb +11 -8
- data/lib/spec/story.rb +10 -0
- data/lib/spec/story/extensions.rb +1 -0
- data/lib/spec/story/extensions/main.rb +86 -0
- data/lib/spec/story/given_scenario.rb +14 -0
- data/lib/spec/story/runner.rb +58 -0
- data/lib/spec/story/runner/plain_text_story_runner.rb +48 -0
- data/lib/spec/story/runner/scenario_collector.rb +18 -0
- data/lib/spec/story/runner/scenario_runner.rb +46 -0
- data/lib/spec/story/runner/story_mediator.rb +123 -0
- data/lib/spec/story/runner/story_parser.rb +227 -0
- data/lib/spec/story/runner/story_runner.rb +67 -0
- data/lib/spec/story/scenario.rb +14 -0
- data/lib/spec/story/step.rb +48 -0
- data/lib/spec/story/step_group.rb +89 -0
- data/lib/spec/story/step_mother.rb +37 -0
- data/lib/spec/story/story.rb +42 -0
- data/lib/spec/story/world.rb +124 -0
- data/lib/spec/version.rb +4 -5
- data/plugins/mock_frameworks/rspec.rb +1 -1
- data/spec/autotest/rspec_spec.rb +13 -7
- data/spec/autotest_helper.rb +4 -3
- data/spec/rspec_suite.rb +7 -0
- data/spec/ruby_forker.rb +13 -0
- data/spec/spec/example/configuration_spec.rb +290 -0
- data/spec/spec/example/example_group_class_definition_spec.rb +48 -0
- data/spec/spec/example/example_group_factory_spec.rb +129 -0
- data/spec/spec/example/example_group_methods_spec.rb +465 -0
- data/spec/spec/example/example_group_spec.rb +711 -0
- data/spec/spec/{dsl → example}/example_matcher_spec.rb +23 -18
- data/spec/spec/example/example_methods_spec.rb +75 -0
- data/spec/spec/example/example_runner_spec.rb +194 -0
- data/spec/spec/example/example_spec.rb +53 -0
- data/spec/spec/example/nested_example_group_spec.rb +59 -0
- data/spec/spec/example/pending_module_spec.rb +31 -0
- data/spec/spec/{dsl → example}/predicate_matcher_spec.rb +1 -1
- data/spec/spec/example/shared_example_group_spec.rb +265 -0
- data/spec/spec/example/subclassing_example_group_spec.rb +25 -0
- data/spec/spec/expectations/differs/default_spec.rb +5 -3
- data/spec/spec/expectations/extensions/object_spec.rb +63 -2
- data/spec/spec/extensions/main_spec.rb +50 -0
- data/spec/spec/interop/test/unit/test_unit_spec_helper.rb +14 -0
- data/spec/spec/interop/test/unit/testcase_spec.rb +10 -0
- data/spec/spec/interop/test/unit/testcase_spec_with_test_unit.rb +20 -0
- data/spec/spec/interop/test/unit/testsuite_adapter_spec.rb +9 -0
- data/spec/spec/interop/test/unit/testsuite_adapter_spec_with_test_unit.rb +34 -0
- data/spec/spec/matchers/be_spec.rb +15 -0
- data/spec/spec/matchers/change_spec.rb +87 -0
- data/spec/spec/matchers/description_generation_spec.rb +31 -37
- data/spec/spec/matchers/exist_spec.rb +31 -22
- data/spec/spec/matchers/handler_spec.rb +42 -1
- data/spec/spec/matchers/have_spec.rb +1 -1
- data/spec/spec/matchers/mock_constraint_matchers_spec.rb +1 -1
- data/spec/spec/matchers/operator_matcher_spec.rb +1 -1
- data/spec/spec/matchers/simple_matcher_spec.rb +31 -0
- data/spec/spec/matchers/throw_symbol_spec.rb +4 -1
- data/spec/spec/mocks/bug_report_10263.rb +24 -0
- data/spec/spec/mocks/bug_report_15719_spec.rb +30 -0
- data/spec/spec/mocks/bug_report_8165_spec.rb +2 -2
- data/spec/spec/mocks/failing_mock_argument_constraints_spec.rb +1 -0
- data/spec/spec/mocks/mock_spec.rb +200 -102
- data/spec/spec/mocks/multiple_return_value_spec.rb +1 -1
- data/spec/spec/mocks/options_hash_spec.rb +19 -7
- data/spec/spec/mocks/partial_mock_spec.rb +31 -9
- data/spec/spec/mocks/passing_mock_argument_constraints_spec.rb +6 -0
- data/spec/spec/mocks/stub_spec.rb +120 -98
- data/spec/spec/package/bin_spec_spec.rb +7 -5
- data/spec/spec/runner/class_and_argument_parser_spec.rb +23 -0
- data/spec/spec/runner/command_line_spec.rb +140 -27
- data/spec/spec/runner/drb_command_line_spec.rb +39 -31
- data/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +44 -0
- data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +16 -11
- data/spec/spec/runner/formatter/html_formatter_spec.rb +60 -50
- data/spec/spec/runner/formatter/profile_formatter_spec.rb +65 -0
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +29 -13
- data/spec/spec/runner/formatter/snippet_extractor_spec.rb +14 -7
- data/spec/spec/runner/formatter/spec_mate_formatter_spec.rb +103 -0
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +103 -39
- data/spec/spec/runner/formatter/story/html_formatter_spec.rb +56 -0
- data/spec/spec/runner/formatter/story/plain_text_formatter_spec.rb +289 -0
- data/spec/spec/runner/heckle_runner_spec.rb +29 -14
- data/spec/spec/runner/heckler_spec.rb +4 -5
- data/spec/spec/runner/noisy_backtrace_tweaker_spec.rb +5 -5
- data/spec/spec/runner/option_parser_spec.rb +86 -58
- data/spec/spec/runner/options_spec.rb +239 -120
- data/spec/spec/runner/output_one_time_fixture.rb +7 -0
- data/spec/spec/runner/output_one_time_fixture_runner.rb +8 -0
- data/spec/spec/runner/output_one_time_spec.rb +16 -0
- data/spec/spec/runner/quiet_backtrace_tweaker_spec.rb +6 -6
- data/spec/spec/runner/reporter_spec.rb +147 -163
- data/spec/spec/runner/spec_parser_spec.rb +31 -0
- data/spec/spec/runner_spec.rb +11 -0
- data/spec/spec/spec_classes.rb +12 -5
- data/spec/spec/story/builders.rb +46 -0
- data/spec/spec/story/extensions/main_spec.rb +161 -0
- data/spec/spec/story/extensions_spec.rb +14 -0
- data/spec/spec/story/given_scenario_spec.rb +27 -0
- data/spec/spec/story/runner/plain_text_story_runner_spec.rb +92 -0
- data/spec/spec/story/runner/scenario_collector_spec.rb +27 -0
- data/spec/spec/story/runner/scenario_runner_spec.rb +142 -0
- data/spec/spec/story/runner/story_mediator_spec.rb +133 -0
- data/spec/spec/story/runner/story_parser_spec.rb +384 -0
- data/spec/spec/story/runner/story_runner_spec.rb +219 -0
- data/spec/spec/story/runner_spec.rb +106 -0
- data/spec/spec/story/scenario_spec.rb +20 -0
- data/spec/spec/story/step_group_spec.rb +157 -0
- data/spec/spec/story/step_mother_spec.rb +72 -0
- data/spec/spec/story/step_spec.rb +147 -0
- data/spec/spec/story/story_helper.rb +2 -0
- data/spec/spec/story/story_spec.rb +86 -0
- data/spec/spec/story/world_spec.rb +416 -0
- data/spec/spec/translator_spec.rb +2 -1
- data/spec/spec_helper.rb +59 -2
- data/stories/all.rb +5 -0
- data/stories/example_groups/autogenerated_docstrings +26 -0
- data/stories/example_groups/example_group_with_should_methods +17 -0
- data/stories/example_groups/nested_groups +17 -0
- data/stories/example_groups/output +20 -0
- data/stories/example_groups/stories.rb +7 -0
- data/stories/helper.rb +6 -0
- data/stories/interop/examples_and_tests_together +30 -0
- data/stories/interop/stories.rb +7 -0
- data/stories/interop/test_case_with_should_methods +17 -0
- data/stories/pending_stories/README +3 -0
- data/stories/resources/helpers/cmdline.rb +9 -0
- data/stories/resources/helpers/story_helper.rb +16 -0
- data/stories/resources/matchers/smart_match.rb +37 -0
- data/stories/resources/spec/example_group_with_should_methods.rb +12 -0
- data/stories/resources/spec/simple_spec.rb +8 -0
- data/stories/resources/steps/running_rspec.rb +50 -0
- data/stories/resources/test/spec_and_test_together.rb +57 -0
- data/stories/resources/test/test_case_with_should_methods.rb +30 -0
- metadata +232 -106
- data/EXAMPLES.rd +0 -111
- data/examples/multi_threaded_behaviour_runner.rb +0 -25
- data/examples/shared_behaviours_example.rb +0 -39
- data/examples/spec_helper.rb +0 -1
- data/examples/test_case_adapter_example.rb +0 -26
- data/examples/test_case_spec.rb +0 -65
- data/lib/spec/dsl.rb +0 -11
- data/lib/spec/dsl/behaviour.rb +0 -220
- data/lib/spec/dsl/behaviour_callbacks.rb +0 -82
- data/lib/spec/dsl/behaviour_eval.rb +0 -231
- data/lib/spec/dsl/behaviour_factory.rb +0 -42
- data/lib/spec/dsl/composite_proc_builder.rb +0 -33
- data/lib/spec/dsl/description.rb +0 -76
- data/lib/spec/dsl/example.rb +0 -135
- data/lib/spec/dsl/example_matcher.rb +0 -40
- data/lib/spec/dsl/example_should_raise_handler.rb +0 -74
- data/lib/spec/runner/behaviour_runner.rb +0 -123
- data/lib/spec/runner/extensions/kernel.rb +0 -50
- data/lib/spec/runner/extensions/object.rb +0 -32
- data/lib/spec/runner/formatter.rb +0 -9
- data/lib/spec/runner/formatter/failing_behaviours_formatter.rb +0 -29
- data/lib/spec/runner/formatter/rdoc_formatter.rb +0 -24
- data/lib/spec/test_case_adapter.rb +0 -10
- data/spec/spec/dsl/behaviour_eval_spec.rb +0 -79
- data/spec/spec/dsl/behaviour_factory_spec.rb +0 -48
- data/spec/spec/dsl/behaviour_spec.rb +0 -661
- data/spec/spec/dsl/composite_proc_builder_spec.rb +0 -44
- data/spec/spec/dsl/configuration_spec.rb +0 -55
- data/spec/spec/dsl/description_spec.rb +0 -89
- data/spec/spec/dsl/example_class_spec.rb +0 -24
- data/spec/spec/dsl/example_instance_spec.rb +0 -160
- data/spec/spec/dsl/example_should_raise_spec.rb +0 -137
- data/spec/spec/dsl/shared_behaviour_spec.rb +0 -252
- data/spec/spec/runner/behaviour_runner_spec.rb +0 -229
- data/spec/spec/runner/context_matching_spec.rb +0 -27
- data/spec/spec/runner/extensions/bug_report_10577_spec.rb +0 -35
- data/spec/spec/runner/extensions/kernel_spec.rb +0 -36
- data/spec/spec/runner/formatter/failing_behaviours_formatter_spec.rb +0 -40
- data/spec/spec/runner/formatter/progress_bar_formatter_dry_run_spec.rb +0 -20
- data/spec/spec/runner/formatter/progress_bar_formatter_failure_dump_spec.rb +0 -36
- data/spec/spec/runner/formatter/rdoc_formatter_dry_run_spec.rb +0 -19
- data/spec/spec/runner/formatter/rdoc_formatter_spec.rb +0 -46
- data/spec/spec/runner/formatter/specdoc_formatter_dry_run_spec.rb +0 -21
- data/spec/spec/runner/object_ext_spec.rb +0 -11
@@ -1,18 +1,16 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
describe "OptionParser" do
|
4
5
|
before(:each) do
|
5
6
|
@out = StringIO.new
|
6
7
|
@err = StringIO.new
|
7
|
-
@parser = Spec::Runner::OptionParser.new
|
8
|
+
@parser = Spec::Runner::OptionParser.new(@err, @out)
|
8
9
|
end
|
9
10
|
|
10
11
|
def parse(args)
|
11
|
-
@parser.parse(args
|
12
|
-
|
13
|
-
|
14
|
-
def behaviour_runner(args)
|
15
|
-
@parser.create_behaviour_runner(args, @err, @out, true)
|
12
|
+
@parser.parse(args)
|
13
|
+
@parser.options
|
16
14
|
end
|
17
15
|
|
18
16
|
it "should accept dry run option" do
|
@@ -48,6 +46,14 @@ describe "OptionParser" do
|
|
48
46
|
options.colour.should == false
|
49
47
|
end
|
50
48
|
|
49
|
+
it "should print help to stdout if no args" do
|
50
|
+
pending 'A regression since 1.0.8' do
|
51
|
+
options = parse([])
|
52
|
+
@out.rewind
|
53
|
+
@out.read.should match(/Usage: spec \(FILE\|DIRECTORY\|GLOB\)\+ \[options\]/m)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
51
57
|
it "should print help to stdout" do
|
52
58
|
options = parse(["--help"])
|
53
59
|
@out.rewind
|
@@ -55,19 +61,17 @@ describe "OptionParser" do
|
|
55
61
|
end
|
56
62
|
|
57
63
|
it "should print instructions about how to require missing formatter" do
|
58
|
-
lambda
|
64
|
+
lambda do
|
65
|
+
options = parse(["--format", "Custom::MissingFormatter"])
|
66
|
+
options.formatters
|
67
|
+
end.should raise_error(NameError)
|
59
68
|
@err.string.should match(/Couldn't find formatter class Custom::MissingFormatter/n)
|
60
69
|
end
|
61
70
|
|
62
|
-
it "should print usage to err if no dir specified" do
|
63
|
-
options = parse([])
|
64
|
-
@err.string.should match(/Usage: spec/)
|
65
|
-
end
|
66
|
-
|
67
71
|
it "should print version to stdout" do
|
68
72
|
options = parse(["--version"])
|
69
73
|
@out.rewind
|
70
|
-
@out.read.should match(/RSpec-\d+\.\d+\.\d+.*\(
|
74
|
+
@out.read.should match(/RSpec-\d+\.\d+\.\d+.*\(build \d+\) - BDD for Ruby\nhttp:\/\/rspec.rubyforge.org\/\n/n)
|
71
75
|
end
|
72
76
|
|
73
77
|
it "should require file when require specified" do
|
@@ -123,14 +127,25 @@ describe "OptionParser" do
|
|
123
127
|
options.formatters[0].class.should equal(Spec::Runner::Formatter::HtmlFormatter)
|
124
128
|
end
|
125
129
|
|
130
|
+
it "should use html story formatter when format is h" do
|
131
|
+
options = parse(["--format", "h"])
|
132
|
+
options.story_formatters[0].class.should equal(Spec::Runner::Formatter::Story::HtmlFormatter)
|
133
|
+
end
|
134
|
+
|
126
135
|
it "should use html formatter when format is html" do
|
127
136
|
options = parse(["--format", "html"])
|
128
137
|
options.formatters[0].class.should equal(Spec::Runner::Formatter::HtmlFormatter)
|
129
138
|
end
|
130
139
|
|
140
|
+
it "should use html story formatter when format is html" do
|
141
|
+
options = parse(["--format", "html"])
|
142
|
+
options.story_formatters[0].class.should equal(Spec::Runner::Formatter::Story::HtmlFormatter)
|
143
|
+
end
|
144
|
+
|
131
145
|
it "should use html formatter with explicit output when format is html:test.html" do
|
132
146
|
FileUtils.rm 'test.html' if File.exist?('test.html')
|
133
147
|
options = parse(["--format", "html:test.html"])
|
148
|
+
options.formatters # creates the file
|
134
149
|
File.should be_exist('test.html')
|
135
150
|
options.formatters[0].class.should equal(Spec::Runner::Formatter::HtmlFormatter)
|
136
151
|
options.formatters[0].close
|
@@ -157,16 +172,6 @@ describe "OptionParser" do
|
|
157
172
|
options.formatters[0].class.should equal(Spec::Runner::Formatter::ProgressBarFormatter)
|
158
173
|
end
|
159
174
|
|
160
|
-
it "should use rdoc formatter when format is r" do
|
161
|
-
options = parse(["--format", "r"])
|
162
|
-
options.formatters[0].class.should equal(Spec::Runner::Formatter::RdocFormatter)
|
163
|
-
end
|
164
|
-
|
165
|
-
it "should use rdoc formatter when format is rdoc" do
|
166
|
-
options = parse(["--format", "rdoc"])
|
167
|
-
options.formatters[0].class.should equal(Spec::Runner::Formatter::RdocFormatter)
|
168
|
-
end
|
169
|
-
|
170
175
|
it "should use specdoc formatter when format is s" do
|
171
176
|
options = parse(["--format", "s"])
|
172
177
|
options.formatters[0].class.should equal(Spec::Runner::Formatter::SpecdocFormatter)
|
@@ -195,9 +200,13 @@ describe "OptionParser" do
|
|
195
200
|
end
|
196
201
|
|
197
202
|
it "should use custom diff format option when format is a custom format" do
|
198
|
-
|
203
|
+
Spec::Expectations.differ.should_not be_instance_of(Custom::Differ)
|
204
|
+
|
205
|
+
options = parse(["--diff", "Custom::Differ"])
|
206
|
+
options.parse_diff "Custom::Differ"
|
199
207
|
options.diff_format.should == :custom
|
200
|
-
options.differ_class.should == Custom::
|
208
|
+
options.differ_class.should == Custom::Differ
|
209
|
+
Spec::Expectations.differ.should be_instance_of(Custom::Differ)
|
201
210
|
end
|
202
211
|
|
203
212
|
it "should print instructions about how to fix missing differ" do
|
@@ -234,7 +243,7 @@ describe "OptionParser" do
|
|
234
243
|
@err.string.should match(/You must specify one file, not a directory when using the --line option/n)
|
235
244
|
end
|
236
245
|
|
237
|
-
it "should fail with error message if file
|
246
|
+
it "should fail with error message if file does not exist along with --line" do
|
238
247
|
spec_parser = mock("spec_parser")
|
239
248
|
@parser.instance_variable_set('@spec_parser', spec_parser)
|
240
249
|
|
@@ -277,18 +286,21 @@ describe "OptionParser" do
|
|
277
286
|
end
|
278
287
|
|
279
288
|
it "should read options from file when --options is specified" do
|
280
|
-
Spec::Runner::CommandLine.should_receive(:run).with(["--diff", "--colour"], @err, @out, true, true)
|
281
289
|
options = parse(["--options", File.dirname(__FILE__) + "/spec.opts"])
|
290
|
+
options.diff_format.should_not be_nil
|
291
|
+
options.colour.should be_true
|
282
292
|
end
|
283
293
|
|
284
|
-
it "should
|
285
|
-
|
286
|
-
options
|
294
|
+
it "should default the formatter to ProgressBarFormatter when using options file" do
|
295
|
+
options = parse(["--options", File.dirname(__FILE__) + "/spec.opts"])
|
296
|
+
options.formatters.first.should be_instance_of(::Spec::Runner::Formatter::ProgressBarFormatter)
|
287
297
|
end
|
288
|
-
|
298
|
+
|
289
299
|
it "should read spaced and multi-line options from file when --options is specified" do
|
290
|
-
Spec::Runner::CommandLine.should_receive(:run).with(["--diff", "--colour", "--format", "s"], @err, @out, true, true)
|
291
300
|
options = parse(["--options", File.dirname(__FILE__) + "/spec_spaced.opts"])
|
301
|
+
options.diff_format.should_not be_nil
|
302
|
+
options.colour.should be_true
|
303
|
+
options.formatters.first.should be_instance_of(::Spec::Runner::Formatter::SpecdocFormatter)
|
292
304
|
end
|
293
305
|
|
294
306
|
it "should save config to file when --generate-options is specified" do
|
@@ -298,52 +310,68 @@ describe "OptionParser" do
|
|
298
310
|
FileUtils.rm 'test.spec.opts'
|
299
311
|
end
|
300
312
|
|
301
|
-
it "should
|
302
|
-
|
303
|
-
options = parse(["
|
304
|
-
|
305
|
-
|
306
|
-
it "should not return an Options object when --drb is specified" do
|
307
|
-
Spec::Runner::DrbCommandLine.stub!(:run)
|
308
|
-
parse(["some/spec.rb", "--drb"]).should be_nil
|
313
|
+
it "should save config to file when -G is specified" do
|
314
|
+
FileUtils.rm 'test.spec.opts' if File.exist?('test.spec.opts')
|
315
|
+
options = parse(["--colour", "-G", "test.spec.opts", "--diff"])
|
316
|
+
IO.read('test.spec.opts').should == "--colour\n--diff\n"
|
317
|
+
FileUtils.rm 'test.spec.opts'
|
309
318
|
end
|
310
319
|
|
320
|
+
it "when --drb is specified, calls DrbCommandLine all of the other ARGV arguments" do
|
321
|
+
options = Spec::Runner::OptionParser.parse([
|
322
|
+
"some/spec.rb", "--diff", "--colour"
|
323
|
+
], @err, @out)
|
324
|
+
Spec::Runner::DrbCommandLine.should_receive(:run).and_return do |options|
|
325
|
+
options.argv.should == ["some/spec.rb", "--diff", "--colour"]
|
326
|
+
end
|
327
|
+
parse(["some/spec.rb", "--diff", "--drb", "--colour"])
|
328
|
+
end
|
329
|
+
|
311
330
|
it "should reverse spec order when --reverse is specified" do
|
312
331
|
options = parse(["some/spec.rb", "--reverse"])
|
313
332
|
end
|
314
333
|
|
315
334
|
it "should set an mtime comparator when --loadby mtime" do
|
316
|
-
|
335
|
+
options = parse(["--loadby", 'mtime'])
|
336
|
+
runner = Spec::Runner::ExampleGroupRunner.new(options)
|
337
|
+
Spec::Runner::ExampleGroupRunner.should_receive(:new).
|
338
|
+
with(options).
|
339
|
+
and_return(runner)
|
340
|
+
runner.should_receive(:load_files).with(["most_recent_spec.rb", "command_line_spec.rb"])
|
341
|
+
|
317
342
|
Dir.chdir(File.dirname(__FILE__)) do
|
343
|
+
options.files << 'command_line_spec.rb'
|
344
|
+
options.files << 'most_recent_spec.rb'
|
318
345
|
FileUtils.touch "most_recent_spec.rb"
|
319
|
-
|
320
|
-
sorted_files = behaviour_runner.sort_paths(all_files)
|
321
|
-
sorted_files.should == ["most_recent_spec.rb", "command_line_spec.rb"]
|
346
|
+
options.run_examples
|
322
347
|
FileUtils.rm "most_recent_spec.rb"
|
323
348
|
end
|
324
349
|
end
|
325
350
|
|
326
351
|
it "should use the standard runner by default" do
|
352
|
+
runner = ::Spec::Runner::ExampleGroupRunner.new(@parser.options)
|
353
|
+
::Spec::Runner::ExampleGroupRunner.should_receive(:new).
|
354
|
+
with(@parser.options).
|
355
|
+
and_return(runner)
|
327
356
|
options = parse([])
|
328
|
-
options.
|
357
|
+
options.run_examples
|
329
358
|
end
|
330
359
|
|
331
360
|
it "should use a custom runner when given" do
|
332
|
-
|
333
|
-
|
361
|
+
runner = Custom::ExampleGroupRunner.new(@parser.options, nil)
|
362
|
+
Custom::ExampleGroupRunner.should_receive(:new).
|
363
|
+
with(@parser.options, nil).
|
364
|
+
and_return(runner)
|
365
|
+
options = parse(["--runner", "Custom::ExampleGroupRunner"])
|
366
|
+
options.run_examples
|
334
367
|
end
|
335
368
|
|
336
369
|
it "should use a custom runner with extra options" do
|
337
|
-
|
338
|
-
|
370
|
+
runner = Custom::ExampleGroupRunner.new(@parser.options, 'something')
|
371
|
+
Custom::ExampleGroupRunner.should_receive(:new).
|
372
|
+
with(@parser.options, 'something').
|
373
|
+
and_return(runner)
|
374
|
+
options = parse(["--runner", "Custom::ExampleGroupRunner:something"])
|
375
|
+
options.run_examples
|
339
376
|
end
|
340
|
-
|
341
|
-
it "should return the correct default behaviour runner" do
|
342
|
-
@parser.create_behaviour_runner([], @err, @out, true).should be_instance_of(Spec::Runner::BehaviourRunner)
|
343
|
-
end
|
344
|
-
|
345
|
-
it "should return the correct default behaviour runner" do
|
346
|
-
@parser.create_behaviour_runner(["--runner", "Custom::BehaviourRunner"], @err, @out, true).should be_instance_of(Custom::BehaviourRunner)
|
347
|
-
end
|
348
|
-
|
349
377
|
end
|
@@ -3,172 +3,291 @@ require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
|
3
3
|
module Spec
|
4
4
|
module Runner
|
5
5
|
describe Options do
|
6
|
-
before do
|
6
|
+
before(:each) do
|
7
7
|
@err = StringIO.new('')
|
8
8
|
@out = StringIO.new('')
|
9
9
|
@options = Options.new(@err, @out)
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
@options.formatters.should == []
|
12
|
+
after(:each) do
|
13
|
+
Spec::Expectations.differ = nil
|
15
14
|
end
|
16
15
|
|
17
|
-
|
18
|
-
|
16
|
+
describe "#examples" do
|
17
|
+
it "should default to empty array" do
|
18
|
+
@options.examples.should == []
|
19
|
+
end
|
19
20
|
end
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
describe "#backtrace_tweaker" do
|
23
|
+
it "should default to QuietBacktraceTweaker" do
|
24
|
+
@options.backtrace_tweaker.class.should == QuietBacktraceTweaker
|
25
|
+
end
|
23
26
|
end
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
+
describe "#dry_run" do
|
29
|
+
it "should default to false" do
|
30
|
+
@options.dry_run.should == false
|
31
|
+
end
|
28
32
|
end
|
29
33
|
|
30
|
-
|
31
|
-
|
32
|
-
|
34
|
+
describe "#context_lines" do
|
35
|
+
it "should default to 3" do
|
36
|
+
@options.context_lines.should == 3
|
37
|
+
end
|
33
38
|
end
|
34
39
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
end
|
40
|
+
describe "#parse_diff with nil" do
|
41
|
+
before(:each) do
|
42
|
+
@options.parse_diff nil
|
43
|
+
end
|
40
44
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
@options.differ_class.should == Spec::Expectations::Differs::Default
|
45
|
-
end
|
45
|
+
it "should make diff_format unified" do
|
46
|
+
@options.diff_format.should == :unified
|
47
|
+
end
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
49
|
+
it "should set Spec::Expectations.differ to be a default differ" do
|
50
|
+
Spec::Expectations.differ.class.should ==
|
51
|
+
::Spec::Expectations::Differs::Default
|
52
|
+
end
|
51
53
|
end
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
55
|
+
describe "#parse_diff with 'unified'" do
|
56
|
+
before(:each) do
|
57
|
+
@options.parse_diff 'unified'
|
58
|
+
end
|
57
59
|
|
58
|
-
|
59
|
-
|
60
|
-
@options.
|
61
|
-
end
|
62
|
-
end
|
60
|
+
it "should make diff_format unified and uses default differ_class" do
|
61
|
+
@options.diff_format.should == :unified
|
62
|
+
@options.differ_class.should equal(Spec::Expectations::Differs::Default)
|
63
|
+
end
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
@options.examples.should eql(["something or other"])
|
65
|
+
it "should set Spec::Expectations.differ to be a default differ" do
|
66
|
+
Spec::Expectations.differ.class.should ==
|
67
|
+
::Spec::Expectations::Differs::Default
|
68
|
+
end
|
69
69
|
end
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
File.should_receive(:open).with(example).and_return(file)
|
76
|
-
|
77
|
-
@options.parse_example example
|
78
|
-
@options.examples.should eql([
|
79
|
-
"Sir, if you were my husband, I would poison your drink.",
|
80
|
-
"Madam, if you were my wife, I would drink it."
|
81
|
-
])
|
82
|
-
end
|
83
|
-
end
|
71
|
+
describe "#parse_diff with 'context'" do
|
72
|
+
before(:each) do
|
73
|
+
@options.parse_diff 'context'
|
74
|
+
end
|
84
75
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
@options = Options.new(@err, @out)
|
90
|
-
end
|
91
|
-
|
92
|
-
it "should split class names with args" do
|
93
|
-
@options.split_at_colon('Foo').should == ['Foo', nil]
|
94
|
-
@options.split_at_colon('Foo:arg').should == ['Foo', 'arg']
|
95
|
-
@options.split_at_colon('Foo::Bar::Zap:arg').should == ['Foo::Bar::Zap', 'arg']
|
96
|
-
@options.split_at_colon('Foo:arg1,arg2').should == ['Foo', 'arg1,arg2']
|
97
|
-
@options.split_at_colon('Foo::Bar::Zap:arg1,arg2').should == ['Foo::Bar::Zap', 'arg1,arg2']
|
98
|
-
@options.split_at_colon('Foo::Bar::Zap:drb://foo,drb://bar').should == ['Foo::Bar::Zap', 'drb://foo,drb://bar']
|
99
|
-
end
|
76
|
+
it "should make diff_format context and uses default differ_class" do
|
77
|
+
@options.diff_format.should == :context
|
78
|
+
@options.differ_class.should == Spec::Expectations::Differs::Default
|
79
|
+
end
|
100
80
|
|
101
|
-
|
102
|
-
|
81
|
+
it "should set Spec::Expectations.differ to be a default differ" do
|
82
|
+
Spec::Expectations.differ.class.should ==
|
83
|
+
::Spec::Expectations::Differs::Default
|
84
|
+
end
|
103
85
|
end
|
104
86
|
|
105
|
-
|
106
|
-
|
107
|
-
@options.
|
108
|
-
end
|
87
|
+
describe "#parse_diff with Custom::Differ" do
|
88
|
+
before(:each) do
|
89
|
+
@options.parse_diff 'Custom::Differ'
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should use custom differ_class" do
|
93
|
+
@options.diff_format.should == :custom
|
94
|
+
@options.differ_class.should == Custom::Differ
|
95
|
+
Spec::Expectations.differ.should be_instance_of(Custom::Differ)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should set Spec::Expectations.differ to be a default differ" do
|
99
|
+
Spec::Expectations.differ.class.should ==
|
100
|
+
::Custom::Differ
|
101
|
+
end
|
109
102
|
end
|
110
|
-
end
|
111
103
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
104
|
+
describe "#parse_diff with missing class name" do
|
105
|
+
it "should raise error" do
|
106
|
+
lambda { @options.parse_diff "Custom::MissingDiffer" }.should raise_error(NameError)
|
107
|
+
@err.string.should match(/Couldn't find differ class Custom::MissingDiffer/n)
|
108
|
+
end
|
117
109
|
end
|
118
110
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
111
|
+
describe "#parse_example" do
|
112
|
+
it "with argument thats not a file path, sets argument as the example" do
|
113
|
+
example = "something or other"
|
114
|
+
File.file?(example).should == false
|
115
|
+
@options.parse_example example
|
116
|
+
@options.examples.should eql(["something or other"])
|
117
|
+
end
|
118
|
+
|
119
|
+
it "with argument that is a file path, sets examples to contents of the file" do
|
120
|
+
example = "#{File.dirname(__FILE__)}/examples.txt"
|
121
|
+
File.should_receive(:file?).with(example).and_return(true)
|
122
|
+
file = StringIO.new("Sir, if you were my husband, I would poison your drink.\nMadam, if you were my wife, I would drink it.")
|
123
|
+
File.should_receive(:open).with(example).and_return(file)
|
124
|
+
|
125
|
+
@options.parse_example example
|
126
|
+
@options.examples.should eql([
|
127
|
+
"Sir, if you were my husband, I would poison your drink.",
|
128
|
+
"Madam, if you were my wife, I would drink it."
|
129
|
+
])
|
130
|
+
end
|
123
131
|
end
|
124
132
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
133
|
+
describe "#examples_should_not_be_run" do
|
134
|
+
it "should cause #run_examples to return true and do nothing" do
|
135
|
+
@options.examples_should_not_be_run
|
136
|
+
ExampleGroupRunner.should_not_receive(:new)
|
137
|
+
|
138
|
+
@options.run_examples.should be_true
|
139
|
+
end
|
129
140
|
end
|
130
141
|
|
131
|
-
|
132
|
-
|
133
|
-
|
142
|
+
describe "#load_class" do
|
143
|
+
it "should raise error when not class name" do
|
144
|
+
lambda do
|
145
|
+
@options.send(:load_class, 'foo', 'fruit', '--food')
|
146
|
+
end.should raise_error('"foo" is not a valid class name')
|
147
|
+
end
|
134
148
|
end
|
135
149
|
|
136
|
-
|
137
|
-
|
138
|
-
|
150
|
+
describe "#reporter" do
|
151
|
+
it "returns a Reporter" do
|
152
|
+
@options.reporter.should be_instance_of(Reporter)
|
153
|
+
@options.reporter.options.should === @options
|
154
|
+
end
|
139
155
|
end
|
140
156
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
157
|
+
describe "#add_example_group affecting passed in example_group" do
|
158
|
+
it "runs all examples when options.examples is nil" do
|
159
|
+
example_1_has_run = false
|
160
|
+
example_2_has_run = false
|
161
|
+
@example_group = Class.new(::Spec::Example::ExampleGroup).describe("Some Examples") do
|
162
|
+
it "runs 1" do
|
163
|
+
example_1_has_run = true
|
164
|
+
end
|
165
|
+
it "runs 2" do
|
166
|
+
example_2_has_run = true
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
@options.examples = nil
|
171
|
+
|
172
|
+
@options.add_example_group @example_group
|
173
|
+
@options.run_examples
|
174
|
+
example_1_has_run.should be_true
|
175
|
+
example_2_has_run.should be_true
|
176
|
+
end
|
177
|
+
|
178
|
+
it "keeps all example_definitions when options.examples is empty" do
|
179
|
+
example_1_has_run = false
|
180
|
+
example_2_has_run = false
|
181
|
+
@example_group = Class.new(::Spec::Example::ExampleGroup).describe("Some Examples") do
|
182
|
+
it "runs 1" do
|
183
|
+
example_1_has_run = true
|
184
|
+
end
|
185
|
+
it "runs 2" do
|
186
|
+
example_2_has_run = true
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
@options.examples = []
|
191
|
+
|
192
|
+
@options.add_example_group @example_group
|
193
|
+
@options.run_examples
|
194
|
+
example_1_has_run.should be_true
|
195
|
+
example_2_has_run.should be_true
|
196
|
+
end
|
145
197
|
end
|
146
198
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
199
|
+
describe "#add_example_group affecting example_group" do
|
200
|
+
it "adds example_group when example_group has example_definitions and is not shared" do
|
201
|
+
@example_group = Class.new(::Spec::Example::ExampleGroup).describe("Some Examples") do
|
202
|
+
it "uses this example_group" do
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
@options.number_of_examples.should == 0
|
207
|
+
@options.add_example_group @example_group
|
208
|
+
@options.number_of_examples.should == 1
|
209
|
+
@options.example_groups.length.should == 1
|
151
210
|
end
|
152
|
-
@options.configure
|
153
211
|
end
|
154
212
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
213
|
+
describe "#remove_example_group" do
|
214
|
+
it "should remove the ExampleGroup from the list of ExampleGroups" do
|
215
|
+
@example_group = Class.new(::Spec::Example::ExampleGroup).describe("Some Examples") do
|
216
|
+
end
|
217
|
+
@options.add_example_group @example_group
|
218
|
+
@options.example_groups.should include(@example_group)
|
219
|
+
|
220
|
+
@options.remove_example_group @example_group
|
221
|
+
@options.example_groups.should_not include(@example_group)
|
222
|
+
end
|
162
223
|
end
|
163
224
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
225
|
+
describe "#run_examples" do
|
226
|
+
it "should use the standard runner by default" do
|
227
|
+
runner = ::Spec::Runner::ExampleGroupRunner.new(@options)
|
228
|
+
::Spec::Runner::ExampleGroupRunner.should_receive(:new).
|
229
|
+
with(@options).
|
230
|
+
and_return(runner)
|
231
|
+
@options.user_input_for_runner = nil
|
232
|
+
|
233
|
+
@options.run_examples
|
234
|
+
end
|
235
|
+
|
236
|
+
it "should use a custom runner when given" do
|
237
|
+
runner = Custom::ExampleGroupRunner.new(@options, nil)
|
238
|
+
Custom::ExampleGroupRunner.should_receive(:new).
|
239
|
+
with(@options, nil).
|
240
|
+
and_return(runner)
|
241
|
+
@options.user_input_for_runner = "Custom::ExampleGroupRunner"
|
242
|
+
|
243
|
+
@options.run_examples
|
244
|
+
end
|
245
|
+
|
246
|
+
it "should use a custom runner with extra options" do
|
247
|
+
runner = Custom::ExampleGroupRunner.new(@options, 'something')
|
248
|
+
Custom::ExampleGroupRunner.should_receive(:new).
|
249
|
+
with(@options, 'something').
|
250
|
+
and_return(runner)
|
251
|
+
@options.user_input_for_runner = "Custom::ExampleGroupRunner:something"
|
252
|
+
|
253
|
+
@options.run_examples
|
254
|
+
end
|
255
|
+
|
256
|
+
describe "#run_examples when there are example_group" do
|
257
|
+
before(:each) do
|
258
|
+
@options.add_example_group Class.new(::Spec::Example::ExampleGroup)
|
259
|
+
@options.formatters << Formatter::BaseTextFormatter.new(@options, @out)
|
260
|
+
end
|
261
|
+
|
262
|
+
it "runs the Examples and outputs the result" do
|
263
|
+
@options.run_examples
|
264
|
+
@out.string.should include("0 examples, 0 failures")
|
265
|
+
end
|
266
|
+
|
267
|
+
it "sets #examples_run? to true" do
|
268
|
+
@options.examples_run?.should be_false
|
269
|
+
@options.run_examples
|
270
|
+
@options.examples_run?.should be_true
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
describe "#run_examples when there are no example_group" do
|
275
|
+
before(:each) do
|
276
|
+
@options.formatters << Formatter::BaseTextFormatter.new(@options, @out)
|
277
|
+
end
|
278
|
+
|
279
|
+
it "does not run Examples and does not output a result" do
|
280
|
+
@options.run_examples
|
281
|
+
@out.string.should_not include("examples")
|
282
|
+
@out.string.should_not include("failures")
|
283
|
+
end
|
284
|
+
|
285
|
+
it "sets #examples_run? to false" do
|
286
|
+
@options.examples_run?.should be_false
|
287
|
+
@options.run_examples
|
288
|
+
@options.examples_run?.should be_false
|
289
|
+
end
|
290
|
+
end
|
172
291
|
end
|
173
292
|
end
|
174
293
|
end
|