rspec 1.2.8 → 1.2.9
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/History.rdoc +41 -2
- data/Manifest.txt +11 -10
- data/Rakefile +47 -22
- data/Ruby1.9.rdoc +1 -2
- data/Upgrade.rdoc +56 -7
- data/bin/spec +2 -1
- data/cucumber.yml +3 -1
- data/examples/failing/README.txt +7 -3
- data/examples/failing/failing_implicit_docstrings_example.rb +0 -2
- data/examples/failing/mocking_example.rb +0 -2
- data/examples/failing/partial_mock_example.rb +0 -2
- data/examples/failing/pending_example.rb +0 -2
- data/examples/failing/predicate_example.rb +0 -2
- data/examples/failing/team_spec.rb +0 -3
- data/examples/failing/timeout_behaviour.rb +0 -2
- data/examples/passing/custom_formatter.rb +0 -1
- data/examples/passing/dynamic_spec.rb +0 -2
- data/examples/passing/file_accessor.rb +1 -2
- data/examples/passing/file_accessor_spec.rb +1 -2
- data/examples/passing/filtered_formatter.rb +0 -1
- data/examples/passing/greeter_spec.rb +0 -1
- data/examples/passing/helper_method_example.rb +0 -2
- data/examples/passing/implicit_docstrings_example.rb +0 -2
- data/examples/passing/io_processor_spec.rb +1 -2
- data/examples/passing/mocking_example.rb +0 -2
- data/examples/passing/nested_classes_example.rb +1 -2
- data/examples/passing/options_example.rb +0 -2
- data/examples/passing/partial_mock_example.rb +0 -2
- data/examples/passing/pending_example.rb +0 -2
- data/examples/passing/predicate_example.rb +0 -2
- data/examples/passing/shared_example_group_example.rb +0 -2
- data/examples/passing/simple_matcher_example.rb +0 -2
- data/examples/passing/stack_spec.rb +2 -3
- data/examples/passing/stack_spec_with_nested_example_groups.rb +2 -3
- data/examples/passing/stubbing_example.rb +0 -2
- data/examples/passing/yielding_example.rb +0 -2
- data/features/before_and_after_blocks/before_and_after_blocks.feature +4 -4
- data/features/command_line/line_number_option.feature +14 -14
- data/features/command_line/line_number_option_with_example_with_no_name.feature +2 -2
- data/features/example_groups/define_example_attribute.feature +41 -0
- data/features/example_groups/example_group_with_should_methods.feature +1 -1
- data/features/example_groups/implicit_docstrings.feature +7 -7
- data/features/example_groups/nested_groups.feature +2 -2
- data/features/expectations/customized_message.feature +4 -4
- data/features/expectations/expect_change.feature +4 -4
- data/features/expectations/expect_error.feature +4 -4
- data/features/extensions/custom_example_group.feature +10 -10
- data/features/formatters/custom_formatter.feature +3 -3
- data/features/interop/examples_and_tests_together.feature +10 -6
- data/features/interop/rspec_output.feature +1 -1
- data/features/interop/test_case_with_should_methods.feature +1 -1
- data/features/load_paths/add_lib_to_load_path.feature +20 -0
- data/features/load_paths/add_spec_to_load_path.feature +20 -0
- data/features/matchers/define_diffable_matcher.feature +2 -2
- data/features/matchers/define_matcher.feature +19 -19
- data/features/matchers/define_matcher_outside_rspec.feature +2 -3
- data/features/matchers/define_matcher_with_fluent_interface.feature +2 -2
- data/features/matchers/define_wrapped_matcher.feature +29 -0
- data/features/mock_framework_integration/use_flexmock.feature +1 -1
- data/features/mock_framework_integration/use_mocha.feature +1 -1
- data/features/mock_framework_integration/use_rr.feature +1 -1
- data/features/mocks/mix_stubs_and_mocks.feature +2 -2
- data/features/mocks/stub_implementation.feature +1 -1
- data/features/pending/pending_examples.feature +16 -16
- data/features/runner/specify_line_number.feature +4 -4
- data/features/spec_helper/spec_helper.feature +25 -0
- data/features/step_definitions/running_rspec_steps.rb +4 -2
- data/features/subject/explicit_subject.feature +2 -2
- data/features/subject/implicit_subject.feature +14 -2
- data/features/support/env.rb +6 -3
- data/lib/spec/adapters/mock_frameworks/mocha.rb +6 -1
- data/lib/spec/example/example_group_methods.rb +7 -0
- data/lib/spec/example/example_methods.rb +1 -1
- data/lib/spec/example/subject.rb +8 -0
- data/lib/spec/interop/test.rb +27 -1
- data/lib/spec/interop/test/unit/testcase.rb +1 -1
- data/lib/spec/matchers/exist.rb +2 -2
- data/lib/spec/matchers/extensions/instance_exec.rb +28 -20
- data/lib/spec/matchers/matcher.rb +21 -20
- data/lib/spec/mocks/argument_matchers.rb +17 -13
- data/lib/spec/mocks/error_generator.rb +14 -3
- data/lib/spec/mocks/{spec_methods.rb → example_methods.rb} +25 -11
- data/lib/spec/mocks/framework.rb +1 -1
- data/lib/spec/mocks/methods.rb +15 -0
- data/lib/spec/mocks/mock.rb +16 -10
- data/lib/spec/mocks/proxy.rb +1 -1
- data/lib/spec/rake/spectask.rb +3 -3
- data/lib/spec/runner/backtrace_tweaker.rb +41 -22
- data/lib/spec/runner/configuration.rb +18 -1
- data/lib/spec/runner/differs/default.rb +1 -1
- data/lib/spec/runner/drb_command_line.rb +5 -2
- data/lib/spec/runner/formatter/base_text_formatter.rb +8 -3
- data/lib/spec/runner/option_parser.rb +21 -15
- data/lib/spec/runner/options.rb +54 -23
- data/lib/spec/version.rb +3 -3
- data/resources/helpers/cmdline.rb +0 -1
- data/spec/autotest/autotest_helper.rb +4 -6
- data/spec/autotest/discover_spec.rb +2 -2
- data/spec/autotest/failed_results_re_spec.rb +1 -1
- data/spec/autotest/rspec_spec.rb +1 -1
- data/spec/spec/dsl/main_spec.rb +1 -1
- data/spec/spec/example/example_group_class_definition_spec.rb +1 -1
- data/spec/spec/example/example_group_factory_spec.rb +1 -1
- data/spec/spec/example/example_group_methods_spec.rb +21 -1
- data/spec/spec/example/example_group_proxy_spec.rb +1 -1
- data/spec/spec/example/example_group_spec.rb +1 -1
- data/spec/spec/example/example_matcher_spec.rb +1 -1
- data/spec/spec/example/example_methods_spec.rb +1 -1
- data/spec/spec/example/example_proxy_spec.rb +1 -1
- data/spec/spec/example/helper_method_spec.rb +1 -1
- data/spec/spec/example/nested_example_group_spec.rb +1 -1
- data/spec/spec/example/predicate_matcher_spec.rb +1 -1
- data/spec/spec/example/shared_example_group_spec.rb +1 -1
- data/spec/spec/example/subclassing_example_group_spec.rb +1 -1
- data/spec/spec/example/subject_spec.rb +17 -1
- data/spec/spec/expectations/differs/default_spec.rb +16 -3
- data/spec/spec/expectations/extensions/kernel_spec.rb +1 -1
- data/spec/spec/expectations/fail_with_spec.rb +1 -1
- data/spec/spec/expectations/handler_spec.rb +1 -1
- data/spec/spec/expectations/wrap_expectation_spec.rb +1 -1
- data/spec/spec/interop/test/unit/resources/test_case_with_various_names.rb +22 -0
- data/spec/spec/interop/test/unit/spec_spec.rb +1 -1
- data/spec/spec/interop/test/unit/test_unit_spec_helper.rb +2 -2
- data/spec/spec/interop/test/unit/testcase_spec.rb +7 -2
- data/spec/spec/interop/test/unit/testsuite_adapter_spec.rb +1 -1
- data/spec/spec/matchers/be_close_spec.rb +1 -1
- data/spec/spec/matchers/be_instance_of_spec.rb +1 -1
- data/spec/spec/matchers/be_kind_of_spec.rb +1 -1
- data/spec/spec/matchers/be_spec.rb +13 -1
- data/spec/spec/matchers/change_spec.rb +1 -1
- data/spec/spec/matchers/compatibility_spec.rb +1 -1
- data/spec/spec/matchers/description_generation_spec.rb +1 -1
- data/spec/spec/matchers/dsl_spec.rb +1 -1
- data/spec/spec/matchers/eql_spec.rb +1 -1
- data/spec/spec/matchers/equal_spec.rb +1 -1
- data/spec/spec/matchers/exist_spec.rb +6 -2
- data/spec/spec/matchers/has_spec.rb +19 -1
- data/spec/spec/matchers/have_spec.rb +1 -1
- data/spec/spec/matchers/include_spec.rb +1 -1
- data/spec/spec/matchers/match_array_spec.rb +1 -1
- data/spec/spec/matchers/match_spec.rb +1 -1
- data/spec/spec/matchers/matcher_methods_spec.rb +1 -1
- data/spec/spec/matchers/matcher_spec.rb +55 -28
- data/spec/spec/matchers/matchers_spec.rb +1 -1
- data/spec/spec/matchers/operator_matcher_spec.rb +1 -1
- data/spec/spec/matchers/raise_error_spec.rb +1 -1
- data/spec/spec/matchers/respond_to_spec.rb +1 -1
- data/spec/spec/matchers/satisfy_spec.rb +1 -1
- data/spec/spec/matchers/simple_matcher_spec.rb +1 -1
- data/spec/spec/matchers/throw_symbol_spec.rb +1 -1
- data/spec/spec/mocks/any_number_of_times_spec.rb +1 -1
- data/spec/spec/mocks/argument_expectation_spec.rb +1 -1
- data/spec/spec/mocks/argument_matchers_spec.rb +19 -0
- data/spec/spec/mocks/at_least_spec.rb +1 -1
- data/spec/spec/mocks/at_most_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_10260_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_10263_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_11545_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_15719_spec.rb +3 -3
- data/spec/spec/mocks/bug_report_496_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_600_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_7611_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_7805_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_8165_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_8302_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_830_spec.rb +1 -1
- data/spec/spec/mocks/double_spec.rb +12 -0
- data/spec/spec/mocks/failing_argument_matchers_spec.rb +6 -6
- data/spec/spec/mocks/hash_including_matcher_spec.rb +1 -1
- data/spec/spec/mocks/hash_not_including_matcher_spec.rb +1 -1
- data/spec/spec/mocks/mock_ordering_spec.rb +4 -4
- data/spec/spec/mocks/mock_space_spec.rb +1 -1
- data/spec/spec/mocks/mock_spec.rb +20 -24
- data/spec/spec/mocks/multiple_return_value_spec.rb +8 -8
- data/spec/spec/mocks/nil_expectation_warning_spec.rb +1 -1
- data/spec/spec/mocks/null_object_mock_spec.rb +1 -1
- data/spec/spec/mocks/once_counts_spec.rb +1 -1
- data/spec/spec/mocks/options_hash_spec.rb +1 -1
- data/spec/spec/mocks/partial_mock_spec.rb +1 -1
- data/spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb +1 -1
- data/spec/spec/mocks/passing_argument_matchers_spec.rb +1 -1
- data/spec/spec/mocks/precise_counts_spec.rb +1 -1
- data/spec/spec/mocks/record_messages_spec.rb +1 -1
- data/spec/spec/mocks/stub_chain_spec.rb +1 -1
- data/spec/spec/mocks/stub_implementation_spec.rb +1 -1
- data/spec/spec/mocks/stub_spec.rb +14 -9
- data/spec/spec/mocks/stubbed_message_expectations_spec.rb +2 -2
- data/spec/spec/mocks/twice_counts_spec.rb +1 -1
- data/spec/spec/mocks/unstub_spec.rb +1 -1
- data/spec/spec/package/bin_spec_spec.rb +4 -10
- data/spec/spec/rake/spectask_spec.rb +2 -2
- data/spec/spec/runner/class_and_argument_parser_spec.rb +1 -1
- data/spec/spec/runner/command_line_spec.rb +1 -1
- data/spec/spec/runner/configuration_spec.rb +15 -6
- data/spec/spec/runner/drb_command_line_spec.rb +1 -1
- data/spec/spec/runner/example_group_runner_spec.rb +1 -1
- data/spec/spec/runner/formatter/base_formatter_spec.rb +1 -1
- data/spec/spec/runner/formatter/base_text_formatter_spec.rb +10 -1
- data/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +1 -1
- data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +1 -1
- data/spec/spec/runner/formatter/html_formatted-1.8.6-jruby.html +72 -76
- data/spec/spec/runner/formatter/html_formatted-1.8.6.html +50 -50
- data/spec/spec/runner/formatter/html_formatted-1.8.7.html +50 -50
- data/spec/spec/runner/formatter/html_formatted-1.9.1.html +61 -69
- data/spec/spec/runner/formatter/html_formatter_spec.rb +26 -26
- data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +1 -1
- data/spec/spec/runner/formatter/profile_formatter_spec.rb +1 -1
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +13 -9
- data/spec/spec/runner/formatter/snippet_extractor_spec.rb +1 -1
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +1 -1
- data/spec/spec/runner/formatter/{text_mate_formatted-1.8.4.html → text_mate_formatted-1.8.6-jruby.html} +64 -59
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +46 -46
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.7.html +46 -46
- data/spec/spec/runner/formatter/text_mate_formatted-1.9.1.html +55 -63
- data/spec/spec/runner/formatter/text_mate_formatter_spec.rb +3 -3
- data/spec/spec/runner/heckle_runner_spec.rb +1 -1
- data/spec/spec/runner/heckler_spec.rb +1 -1
- data/spec/spec/runner/line_number_query/line_number_query_fixture.rb +1 -1
- data/spec/spec/runner/line_number_query_spec.rb +10 -1
- data/spec/spec/runner/noisy_backtrace_tweaker_spec.rb +22 -16
- data/spec/spec/runner/option_parser_spec.rb +48 -14
- data/spec/spec/runner/options_spec.rb +16 -2
- data/spec/spec/runner/output_one_time_fixture.rb +1 -1
- data/spec/spec/runner/output_one_time_fixture_runner.rb +2 -3
- data/spec/spec/runner/output_one_time_spec.rb +6 -7
- data/spec/spec/runner/quiet_backtrace_tweaker_spec.rb +65 -22
- data/spec/spec/runner/reporter_spec.rb +1 -1
- data/spec/spec/runner_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -7
- data/spec/{spec → support}/spec_classes.rb +0 -0
- metadata +58 -17
- data/examples/failing/spec_helper.rb +0 -3
- data/examples/passing/spec_helper.rb +0 -3
- data/features/heckle/heckle.feature +0 -56
- data/spec/rspec_suite.rb +0 -6
- data/spec/spec/runner/formatter/html_formatted-1.8.4.html +0 -366
- data/spec/spec/runner/formatter/html_formatted-1.8.5-jruby.html +0 -387
- data/spec/spec/runner/formatter/html_formatted-1.8.5.html +0 -372
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
|
2
1
|
class FileAccessor
|
|
3
2
|
def open_and_handle_with(pathname, processor)
|
|
4
3
|
pathname.open do |io|
|
|
@@ -8,7 +7,7 @@ class FileAccessor
|
|
|
8
7
|
end
|
|
9
8
|
|
|
10
9
|
if __FILE__ == $0
|
|
11
|
-
require
|
|
10
|
+
require 'examples/passing/io_processor'
|
|
12
11
|
require 'pathname'
|
|
13
12
|
|
|
14
13
|
accessor = FileAccessor.new
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
# bin/spec --require examples/passing/options_formatter.rb examples/passing/options_example.rb \
|
|
5
5
|
# --format OptionsFormatter
|
|
6
6
|
|
|
7
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
|
8
|
-
|
|
9
7
|
describe "this group will be reported", :report => true do
|
|
10
8
|
it "this example will be reported", :report => true do
|
|
11
9
|
# no-op
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
require File.dirname(__FILE__) + '/shared_stack_examples'
|
|
1
|
+
require 'examples/passing/stack'
|
|
2
|
+
require 'examples/passing/shared_stack_examples'
|
|
4
3
|
|
|
5
4
|
describe Stack, " (empty)" do
|
|
6
5
|
before(:each) do
|
|
@@ -58,7 +58,7 @@ Feature: before and after blocks
|
|
|
58
58
|
end
|
|
59
59
|
"""
|
|
60
60
|
When I run "spec before_each_in_example_group_spec.rb"
|
|
61
|
-
Then the stdout should
|
|
61
|
+
Then the stdout should include "3 examples, 0 failures"
|
|
62
62
|
|
|
63
63
|
Scenario: define before(:all) block in example group
|
|
64
64
|
Given a file named "before_all_in_example_group_spec.rb" with:
|
|
@@ -90,7 +90,7 @@ Feature: before and after blocks
|
|
|
90
90
|
end
|
|
91
91
|
"""
|
|
92
92
|
When I run "spec before_all_in_example_group_spec.rb"
|
|
93
|
-
Then the stdout should
|
|
93
|
+
Then the stdout should include "3 examples, 0 failures"
|
|
94
94
|
|
|
95
95
|
Scenario: define before and after blocks in configuration
|
|
96
96
|
Given a file named "befores_in_configuration_spec.rb" with:
|
|
@@ -126,7 +126,7 @@ Feature: before and after blocks
|
|
|
126
126
|
end
|
|
127
127
|
"""
|
|
128
128
|
When I run "spec befores_in_configuration_spec.rb"
|
|
129
|
-
Then the stdout should
|
|
129
|
+
Then the stdout should include "3 examples, 0 failures"
|
|
130
130
|
|
|
131
131
|
Scenario: before/after blocks are run in order
|
|
132
132
|
Given a file named "ensure_block_order_spec.rb" with:
|
|
@@ -163,5 +163,5 @@ Feature: before and after blocks
|
|
|
163
163
|
end
|
|
164
164
|
"""
|
|
165
165
|
When I run "spec ensure_block_order_spec.rb"
|
|
166
|
-
Then the stdout should
|
|
166
|
+
Then the stdout should include /before suite\nbefore all\nbefore each\nafter each\n\.after all\n.*after suite/m
|
|
167
167
|
|
|
@@ -21,36 +21,36 @@ Feature: Spec and test together
|
|
|
21
21
|
|
|
22
22
|
Scenario: two examples - first example on declaration line
|
|
23
23
|
When I run "spec example.rb:3 --format nested"
|
|
24
|
-
Then the stdout should
|
|
25
|
-
And the stdout should
|
|
24
|
+
Then the stdout should include "1 example, 0 failures"
|
|
25
|
+
And the stdout should include "has a first example"
|
|
26
26
|
But the stdout should not match "has a second example"
|
|
27
27
|
|
|
28
28
|
Scenario: two examples - first example from line inside declaration
|
|
29
29
|
When I run "spec example.rb:4 --format nested"
|
|
30
|
-
Then the stdout should
|
|
31
|
-
And the stdout should
|
|
30
|
+
Then the stdout should include "1 example, 0 failures"
|
|
31
|
+
And the stdout should include "has a first example"
|
|
32
32
|
But the stdout should not match "has a second example"
|
|
33
33
|
|
|
34
34
|
Scenario: two examples - first example from line below declaration
|
|
35
35
|
When I run "spec example.rb:6 --format nested"
|
|
36
|
-
Then the stdout should
|
|
37
|
-
And the stdout should
|
|
36
|
+
Then the stdout should include "1 example, 0 failures"
|
|
37
|
+
And the stdout should include "has a first example"
|
|
38
38
|
But the stdout should not match "has a second example"
|
|
39
39
|
|
|
40
40
|
Scenario: two examples - second example from line below declaration
|
|
41
41
|
When I run "spec example.rb:7 --format nested"
|
|
42
|
-
Then the stdout should
|
|
43
|
-
And the stdout should
|
|
42
|
+
Then the stdout should include "1 example, 0 failures"
|
|
43
|
+
And the stdout should include "has a second example"
|
|
44
44
|
But the stdout should not match "has a first example"
|
|
45
45
|
|
|
46
46
|
Scenario: two examples - both examples from the group declaration
|
|
47
47
|
When I run "spec example.rb:1 --format nested"
|
|
48
|
-
Then the stdout should
|
|
49
|
-
And the stdout should
|
|
50
|
-
And the stdout should
|
|
48
|
+
Then the stdout should include "2 examples, 0 failures"
|
|
49
|
+
And the stdout should include "has a second example"
|
|
50
|
+
And the stdout should include "has a first example"
|
|
51
51
|
|
|
52
52
|
Scenario: two examples - both examples from above the first example declaration
|
|
53
53
|
When I run "spec example.rb:2 --format nested"
|
|
54
|
-
Then the stdout should
|
|
55
|
-
And the stdout should
|
|
56
|
-
And the stdout should
|
|
54
|
+
Then the stdout should include "2 examples, 0 failures"
|
|
55
|
+
And the stdout should include "has a second example"
|
|
56
|
+
And the stdout should include "has a first example"
|
|
@@ -17,6 +17,6 @@ Feature: Spec and test together
|
|
|
17
17
|
|
|
18
18
|
Scenario: two examples - first example on declaration line
|
|
19
19
|
When I run "spec example.rb:3 --format nested"
|
|
20
|
-
Then the stdout should
|
|
21
|
-
Then the stdout should
|
|
20
|
+
Then the stdout should include "1 example, 0 failures"
|
|
21
|
+
Then the stdout should include "should be > 8"
|
|
22
22
|
But the stdout should not match "should be < 10"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Feature: Define example attribute
|
|
2
|
+
|
|
3
|
+
In order to streamline process
|
|
4
|
+
As an RSpec user
|
|
5
|
+
I want to easily define helper methods that act as a variable assignment
|
|
6
|
+
|
|
7
|
+
It is fairly common to start with a local variable in one example, use the same
|
|
8
|
+
local variable in the next, and then extract the declaration of that variable
|
|
9
|
+
to before(:each). This requires converting the locals to instance variables.
|
|
10
|
+
|
|
11
|
+
This feature streamlines the process by defining a helper method so you can extract
|
|
12
|
+
the duplication without having to change other references to the same variables
|
|
13
|
+
to @instance_variables.
|
|
14
|
+
|
|
15
|
+
Scenario:
|
|
16
|
+
Given a file named "counter_spec.rb" with:
|
|
17
|
+
"""
|
|
18
|
+
require 'spec/autorun'
|
|
19
|
+
|
|
20
|
+
class Counter
|
|
21
|
+
def initialize
|
|
22
|
+
@count = 0
|
|
23
|
+
end
|
|
24
|
+
def count
|
|
25
|
+
@count += 1
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe Counter do
|
|
30
|
+
let(:counter) { Counter.new }
|
|
31
|
+
it "returns 1 the first time" do
|
|
32
|
+
counter.count.should == 1
|
|
33
|
+
end
|
|
34
|
+
it "returns 2 the second time because the counter itself is cached by the 'assign' method" do
|
|
35
|
+
counter.count
|
|
36
|
+
counter.count.should == 2
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
"""
|
|
40
|
+
When I run "spec counter_spec.rb"
|
|
41
|
+
Then the stdout should include "2 examples, 0 failures"
|
|
@@ -21,7 +21,7 @@ Feature: Spec::ExampleGroup with should methods
|
|
|
21
21
|
"""
|
|
22
22
|
When I run "<Command> example_group_with_should_methods.rb"
|
|
23
23
|
Then the exit code should be 256
|
|
24
|
-
And the stdout should
|
|
24
|
+
And the stdout should include "2 examples, 1 failure"
|
|
25
25
|
|
|
26
26
|
Scenarios: Run with ruby and spec
|
|
27
27
|
| Command |
|
|
@@ -21,9 +21,9 @@ Feature: implicit docstrings
|
|
|
21
21
|
|
|
22
22
|
When I run "<Command> implicit_docstrings_example.rb -fs"
|
|
23
23
|
|
|
24
|
-
Then the stdout should
|
|
25
|
-
And the stdout should
|
|
26
|
-
And the stdout should
|
|
24
|
+
Then the stdout should include /should be < 5/
|
|
25
|
+
And the stdout should include /should include "a"/
|
|
26
|
+
And the stdout should include /should respond to #size/
|
|
27
27
|
|
|
28
28
|
Scenarios: Run with ruby and spec
|
|
29
29
|
| Command |
|
|
@@ -53,7 +53,7 @@ Feature: implicit docstrings
|
|
|
53
53
|
|
|
54
54
|
When I run "<Command> failing_implicit_docstrings_example.rb -fs"
|
|
55
55
|
|
|
56
|
-
Then the stdout should
|
|
57
|
-
And the stdout should
|
|
58
|
-
And the stdout should
|
|
59
|
-
And the stdout should
|
|
56
|
+
Then the stdout should include /should equal 2/
|
|
57
|
+
And the stdout should include /should be > 5/
|
|
58
|
+
And the stdout should include /should include "b"/
|
|
59
|
+
And the stdout should include /should not respond to #size/
|
|
@@ -23,8 +23,8 @@ Feature: Nested example groups
|
|
|
23
23
|
end
|
|
24
24
|
"""
|
|
25
25
|
When I run "<Command> nested_example_groups.rb -fs"
|
|
26
|
-
Then the stdout should
|
|
27
|
-
And the stdout should
|
|
26
|
+
Then the stdout should include /Some Object with some more context/
|
|
27
|
+
And the stdout should include /Some Object with some other context/
|
|
28
28
|
|
|
29
29
|
Scenarios: Run with ruby and spec
|
|
30
30
|
| Command |
|
|
@@ -46,9 +46,9 @@ Feature: customized message
|
|
|
46
46
|
|
|
47
47
|
"""
|
|
48
48
|
When I run "spec node_spec.rb.rb --format specdoc"
|
|
49
|
-
Then the stdout should
|
|
49
|
+
Then the stdout should include "3 examples, 3 failures"
|
|
50
50
|
And the stdout should not match "to return true, got false"
|
|
51
51
|
And the stdout should not match "to return false, got true"
|
|
52
|
-
And the stdout should
|
|
53
|
-
And the stdout should
|
|
54
|
-
And the stdout should
|
|
52
|
+
And the stdout should include "node.state: started (first example)"
|
|
53
|
+
And the stdout should include "node.state: started (second example)"
|
|
54
|
+
And the stdout should include "expected a change"
|
|
@@ -30,8 +30,8 @@ Feature: expect change
|
|
|
30
30
|
end
|
|
31
31
|
"""
|
|
32
32
|
When I run "spec expect_change.rb"
|
|
33
|
-
Then the stdout should
|
|
34
|
-
Then the stdout should
|
|
33
|
+
Then the stdout should include "2 examples, 1 failure"
|
|
34
|
+
Then the stdout should include "should have been changed by 2, but was changed by 1"
|
|
35
35
|
|
|
36
36
|
Scenario: expecting no change
|
|
37
37
|
Given a file named "expect_no_change.rb" with:
|
|
@@ -61,5 +61,5 @@ Feature: expect change
|
|
|
61
61
|
end
|
|
62
62
|
"""
|
|
63
63
|
When I run "spec expect_no_change.rb"
|
|
64
|
-
Then the stdout should
|
|
65
|
-
Then the stdout should
|
|
64
|
+
Then the stdout should include "2 examples, 1 failure"
|
|
65
|
+
Then the stdout should include "should not have changed, but did change from 1 to 2"
|
|
@@ -19,8 +19,8 @@ Feature: expect error
|
|
|
19
19
|
end
|
|
20
20
|
"""
|
|
21
21
|
When I run "spec expect_error.rb"
|
|
22
|
-
Then the stdout should
|
|
23
|
-
Then the stdout should
|
|
22
|
+
Then the stdout should include "2 examples, 1 failure"
|
|
23
|
+
Then the stdout should include "expected NameError but nothing was raised"
|
|
24
24
|
|
|
25
25
|
Scenario: expect no error
|
|
26
26
|
Given a file named "expect_no_error.rb" with:
|
|
@@ -39,6 +39,6 @@ Feature: expect error
|
|
|
39
39
|
end
|
|
40
40
|
"""
|
|
41
41
|
When I run "spec expect_no_error.rb"
|
|
42
|
-
Then the stdout should
|
|
43
|
-
Then the stdout should
|
|
42
|
+
Then the stdout should include "2 examples, 1 failure"
|
|
43
|
+
Then the stdout should include "undefined method `non_existent_message'"
|
|
44
44
|
|
|
@@ -2,18 +2,18 @@ Feature: custom example group
|
|
|
2
2
|
|
|
3
3
|
Scenario: simple custom example group
|
|
4
4
|
Given a file named "custom_example_group_spec.rb" with:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
"""
|
|
6
|
+
class CustomGroup < Spec::ExampleGroup
|
|
7
|
+
end
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Spec::Example::ExampleGroupFactory.default(CustomGroup)
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
describe "a custom group set as the default" do
|
|
12
|
+
it "becomes the default base class for example groups" do
|
|
13
|
+
CustomGroup.should === self
|
|
14
|
+
end
|
|
14
15
|
end
|
|
15
|
-
|
|
16
|
-
"""
|
|
16
|
+
"""
|
|
17
17
|
When I run "spec custom_example_group_spec.rb"
|
|
18
|
-
Then the stdout should
|
|
18
|
+
Then the stdout should include "1 example, 0 failures"
|
|
19
19
|
|