rspec-core 2.5.1 → 2.6.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/.travis.yml +7 -0
- data/Gemfile +12 -14
- data/README.md +4 -1
- data/Rakefile +29 -12
- data/cucumber.yml +1 -1
- data/features/.nav +15 -9
- data/features/Autotest.md +31 -7
- data/features/Changelog.md +46 -3
- data/features/Upgrade.md +35 -2
- data/features/command_line/README.md +22 -0
- data/features/command_line/configure.feature +2 -2
- data/features/command_line/example_name_option.feature +10 -10
- data/features/command_line/exit_status.feature +4 -4
- data/features/command_line/format_option.feature +4 -4
- data/features/command_line/line_number_appended_to_path.feature +11 -11
- data/features/command_line/line_number_option.feature +2 -2
- data/features/command_line/rake_task.feature +3 -3
- data/features/command_line/tag.feature +30 -14
- data/features/configuration/alias_example_to.feature +48 -0
- data/features/configuration/custom_settings.feature +3 -3
- data/features/configuration/fail_fast.feature +3 -3
- data/features/configuration/read_options_from_file.feature +4 -4
- data/features/example_groups/basic_structure.feature +11 -15
- data/features/example_groups/shared_context.feature +74 -0
- data/features/example_groups/shared_example_group.feature +21 -17
- data/features/expectation_framework_integration/configure_expectation_framework.feature +15 -4
- data/features/filtering/exclusion_filters.feature +28 -4
- data/features/filtering/{implicit_filters.feature → if_and_unless.feature} +9 -7
- data/features/filtering/inclusion_filters.feature +26 -3
- data/features/filtering/run_all_when_everything_filtered.feature +2 -2
- data/features/formatters/custom_formatter.feature +1 -1
- data/features/formatters/text_formatter.feature +43 -0
- data/features/helper_methods/arbitrary_methods.feature +2 -2
- data/features/helper_methods/let.feature +2 -2
- data/features/helper_methods/modules.feature +149 -0
- data/features/hooks/around_hooks.feature +18 -11
- data/features/hooks/before_and_after_hooks.feature +15 -19
- data/features/hooks/filtering.feature +160 -124
- data/features/metadata/current_example.feature +17 -0
- data/features/metadata/described_class.feature +2 -2
- data/features/metadata/user_defined.feature +111 -0
- data/features/mock_framework_integration/use_any_framework.feature +1 -1
- data/features/mock_framework_integration/use_flexmock.feature +83 -10
- data/features/mock_framework_integration/use_mocha.feature +84 -10
- data/features/mock_framework_integration/use_rr.feature +85 -10
- data/features/mock_framework_integration/use_rspec.feature +84 -10
- data/features/pending/pending_examples.feature +8 -8
- data/features/spec_files/arbitrary_file_suffix.feature +1 -1
- data/features/step_definitions/additional_cli_steps.rb +11 -1
- data/features/subject/attribute_of_subject.feature +24 -4
- data/features/subject/explicit_subject.feature +5 -5
- data/features/subject/implicit_receiver.feature +2 -2
- data/features/subject/implicit_subject.feature +2 -2
- data/features/support/env.rb +6 -1
- data/lib/rspec/core/backward_compatibility.rb +12 -2
- data/lib/rspec/core/command_line.rb +2 -5
- data/lib/rspec/core/configuration.rb +70 -38
- data/lib/rspec/core/configuration_options.rb +6 -23
- data/lib/rspec/core/drb_command_line.rb +5 -11
- data/lib/rspec/core/example.rb +29 -21
- data/lib/rspec/core/example_group.rb +40 -8
- data/lib/rspec/core/extensions/object.rb +0 -1
- data/lib/rspec/core/formatters/base_formatter.rb +6 -0
- data/lib/rspec/core/formatters/base_text_formatter.rb +1 -1
- data/lib/rspec/core/formatters/helpers.rb +0 -4
- data/lib/rspec/core/hooks.rb +14 -4
- data/lib/rspec/core/metadata.rb +1 -1
- data/lib/rspec/core/metadata_hash_builder.rb +93 -0
- data/lib/rspec/core/mocking/with_flexmock.rb +2 -0
- data/lib/rspec/core/mocking/with_mocha.rb +2 -0
- data/lib/rspec/core/mocking/with_rr.rb +2 -0
- data/lib/rspec/core/mocking/with_rspec.rb +3 -1
- data/lib/rspec/core/option_parser.rb +9 -2
- data/lib/rspec/core/pending.rb +10 -3
- data/lib/rspec/core/reporter.rb +2 -2
- data/lib/rspec/core/runner.rb +38 -13
- data/lib/rspec/core/shared_example_group.rb +18 -4
- data/lib/rspec/core/subject.rb +4 -6
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +70 -18
- data/lib/rspec/core.rb +29 -0
- data/lib/rspec/monkey/spork/test_framework/rspec.rb +1 -0
- data/rspec-core.gemspec +3 -5
- data/spec/autotest/failed_results_re_spec.rb +2 -2
- data/spec/rspec/core/command_line_spec.rb +36 -2
- data/spec/rspec/core/configuration_spec.rb +150 -70
- data/spec/rspec/core/deprecations_spec.rb +21 -0
- data/spec/rspec/core/drb_command_line_spec.rb +21 -56
- data/spec/rspec/core/example_group_spec.rb +213 -56
- data/spec/rspec/core/example_spec.rb +110 -0
- data/spec/rspec/core/formatters/base_formatter_spec.rb +23 -2
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +9 -0
- data/spec/rspec/core/formatters/helpers_spec.rb +1 -1
- data/spec/rspec/core/formatters/html_formatted-1.8.6.html +5 -5
- data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +8 -10
- data/spec/rspec/core/formatters/html_formatted-1.8.7.html +5 -5
- data/spec/rspec/core/formatters/html_formatted-1.9.1.html +5 -5
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +5 -5
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +0 -1
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.6.html +5 -5
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +8 -10
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +5 -5
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.1.html +5 -5
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +5 -5
- data/spec/rspec/core/hooks_spec.rb +86 -0
- data/spec/rspec/core/metadata_spec.rb +7 -7
- data/spec/rspec/core/option_parser_spec.rb +26 -15
- data/spec/rspec/core/pending_example_spec.rb +12 -51
- data/spec/rspec/core/reporter_spec.rb +19 -3
- data/spec/rspec/core/resources/formatter_specs.rb +7 -1
- data/spec/rspec/core/rspec_matchers_spec.rb +45 -0
- data/spec/rspec/core/runner_spec.rb +42 -10
- data/spec/rspec/core/shared_example_group_spec.rb +57 -21
- data/spec/rspec/core/subject_spec.rb +32 -11
- data/spec/rspec/core/world_spec.rb +147 -15
- data/spec/rspec/core_spec.rb +28 -0
- data/spec/spec_helper.rb +22 -2
- data/spec/support/matchers.rb +44 -13
- data/spec/support/shared_example_groups.rb +41 -0
- data/spec/support/spec_files.rb +44 -0
- data/spec.txt +1126 -0
- metadata +35 -16
- data/spec/ruby_forker.rb +0 -13
|
@@ -1,23 +1,97 @@
|
|
|
1
1
|
Feature: mock with mocha
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
I want to be able to use mocha
|
|
3
|
+
Configure RSpec to use mocha as shown in the scenarios below.
|
|
5
4
|
|
|
6
|
-
Scenario:
|
|
7
|
-
Given a file named "
|
|
5
|
+
Scenario: passing message expectation
|
|
6
|
+
Given a file named "example_spec.rb" with:
|
|
8
7
|
"""
|
|
9
8
|
RSpec.configure do |config|
|
|
10
9
|
config.mock_framework = :mocha
|
|
11
10
|
end
|
|
12
11
|
|
|
13
|
-
describe "
|
|
14
|
-
it "
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
describe "mocking with RSpec" do
|
|
13
|
+
it "passes when it should" do
|
|
14
|
+
receiver = mock('receiver')
|
|
15
|
+
receiver.expects(:message).once
|
|
16
|
+
receiver.message
|
|
18
17
|
end
|
|
19
18
|
end
|
|
20
19
|
"""
|
|
21
|
-
When I run
|
|
20
|
+
When I run `rspec example_spec.rb`
|
|
22
21
|
Then the examples should all pass
|
|
22
|
+
|
|
23
|
+
Scenario: failing message expecation
|
|
24
|
+
Given a file named "example_spec.rb" with:
|
|
25
|
+
"""
|
|
26
|
+
RSpec.configure do |config|
|
|
27
|
+
config.mock_framework = :mocha
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe "mocking with RSpec" do
|
|
31
|
+
it "fails when it should" do
|
|
32
|
+
receiver = mock('receiver')
|
|
33
|
+
receiver.expects(:message).once
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
"""
|
|
37
|
+
When I run `rspec example_spec.rb`
|
|
38
|
+
Then the output should contain "1 example, 1 failure"
|
|
39
|
+
|
|
40
|
+
Scenario: failing message expectation in pending block (remains pending)
|
|
41
|
+
Given a file named "example_spec.rb" with:
|
|
42
|
+
"""
|
|
43
|
+
RSpec.configure do |config|
|
|
44
|
+
config.mock_framework = :mocha
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe "failed message expectation in a pending block" do
|
|
48
|
+
it "is listed as pending" do
|
|
49
|
+
pending do
|
|
50
|
+
receiver = mock('receiver')
|
|
51
|
+
receiver.expects(:message).once
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
"""
|
|
56
|
+
When I run `rspec example_spec.rb`
|
|
57
|
+
Then the output should contain "1 example, 0 failures, 1 pending"
|
|
23
58
|
And the exit status should be 0
|
|
59
|
+
|
|
60
|
+
Scenario: passing message expectation in pending block (fails)
|
|
61
|
+
Given a file named "example_spec.rb" with:
|
|
62
|
+
"""
|
|
63
|
+
RSpec.configure do |config|
|
|
64
|
+
config.mock_framework = :mocha
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
describe "passing message expectation in a pending block" do
|
|
68
|
+
it "fails with FIXED" do
|
|
69
|
+
pending do
|
|
70
|
+
receiver = mock('receiver')
|
|
71
|
+
receiver.expects(:message).once
|
|
72
|
+
receiver.message
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
"""
|
|
77
|
+
When I run `rspec example_spec.rb`
|
|
78
|
+
Then the output should contain "FIXED"
|
|
79
|
+
Then the output should contain "1 example, 1 failure"
|
|
80
|
+
And the exit status should be 1
|
|
81
|
+
|
|
82
|
+
Scenario: accessing RSpec.configuration.mock_framework.framework_name
|
|
83
|
+
Given a file named "example_spec.rb" with:
|
|
84
|
+
"""
|
|
85
|
+
RSpec.configure do |config|
|
|
86
|
+
config.mock_framework = :mocha
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
describe "RSpec.configuration.mock_framework.framework_name" do
|
|
90
|
+
it "returns :mocha" do
|
|
91
|
+
RSpec.configuration.mock_framework.framework_name.should eq(:mocha)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
"""
|
|
95
|
+
When I run `rspec example_spec.rb`
|
|
96
|
+
Then the examples should all pass
|
|
97
|
+
|
|
@@ -1,23 +1,98 @@
|
|
|
1
1
|
Feature: mock with rr
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
I want to be able to use rr
|
|
3
|
+
Configure RSpec to use rr as shown in the scenarios below.
|
|
5
4
|
|
|
6
|
-
Scenario:
|
|
7
|
-
Given a file named "
|
|
5
|
+
Scenario: passing message expectation
|
|
6
|
+
Given a file named "example_spec.rb" with:
|
|
8
7
|
"""
|
|
9
8
|
RSpec.configure do |config|
|
|
10
9
|
config.mock_framework = :rr
|
|
11
10
|
end
|
|
12
11
|
|
|
13
|
-
describe "
|
|
14
|
-
it "
|
|
15
|
-
|
|
16
|
-
mock(
|
|
17
|
-
|
|
12
|
+
describe "mocking with RSpec" do
|
|
13
|
+
it "passes when it should" do
|
|
14
|
+
receiver = Object.new
|
|
15
|
+
mock(receiver).message
|
|
16
|
+
receiver.message
|
|
18
17
|
end
|
|
19
18
|
end
|
|
20
19
|
"""
|
|
21
|
-
When I run
|
|
20
|
+
When I run `rspec example_spec.rb`
|
|
22
21
|
Then the examples should all pass
|
|
22
|
+
|
|
23
|
+
Scenario: failing message expecation
|
|
24
|
+
Given a file named "example_spec.rb" with:
|
|
25
|
+
"""
|
|
26
|
+
RSpec.configure do |config|
|
|
27
|
+
config.mock_framework = :rr
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe "mocking with RSpec" do
|
|
31
|
+
it "fails when it should" do
|
|
32
|
+
receiver = Object.new
|
|
33
|
+
mock(receiver).message
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
"""
|
|
37
|
+
When I run `rspec example_spec.rb`
|
|
38
|
+
Then the output should contain "1 example, 1 failure"
|
|
39
|
+
|
|
40
|
+
Scenario: failing message expectation in pending block (remains pending)
|
|
41
|
+
Given a file named "example_spec.rb" with:
|
|
42
|
+
"""
|
|
43
|
+
RSpec.configure do |config|
|
|
44
|
+
config.mock_framework = :rr
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe "failed message expectation in a pending block" do
|
|
48
|
+
it "is listed as pending" do
|
|
49
|
+
pending do
|
|
50
|
+
receiver = Object.new
|
|
51
|
+
mock(receiver).message
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
"""
|
|
56
|
+
When I run `rspec example_spec.rb`
|
|
57
|
+
Then the output should contain "1 example, 0 failures, 1 pending"
|
|
23
58
|
And the exit status should be 0
|
|
59
|
+
|
|
60
|
+
Scenario: passing message expectation in pending block (fails)
|
|
61
|
+
Given a file named "example_spec.rb" with:
|
|
62
|
+
"""
|
|
63
|
+
RSpec.configure do |config|
|
|
64
|
+
config.mock_framework = :rr
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
describe "passing message expectation in a pending block" do
|
|
68
|
+
it "fails with FIXED" do
|
|
69
|
+
pending do
|
|
70
|
+
receiver = Object.new
|
|
71
|
+
mock(receiver).message
|
|
72
|
+
receiver.message
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
"""
|
|
77
|
+
When I run `rspec example_spec.rb`
|
|
78
|
+
Then the output should contain "FIXED"
|
|
79
|
+
Then the output should contain "1 example, 1 failure"
|
|
80
|
+
And the exit status should be 1
|
|
81
|
+
|
|
82
|
+
Scenario: accessing RSpec.configuration.mock_framework.framework_name
|
|
83
|
+
Given a file named "example_spec.rb" with:
|
|
84
|
+
"""
|
|
85
|
+
RSpec.configure do |config|
|
|
86
|
+
config.mock_framework = :rr
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
describe "RSpec.configuration.mock_framework.framework_name" do
|
|
90
|
+
it "returns :rr" do
|
|
91
|
+
RSpec.configuration.mock_framework.framework_name.should eq(:rr)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
"""
|
|
95
|
+
When I run `rspec example_spec.rb`
|
|
96
|
+
Then the examples should all pass
|
|
97
|
+
|
|
98
|
+
|
|
@@ -1,23 +1,97 @@
|
|
|
1
1
|
Feature: mock with rspec
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
RSpec uses its own mocking framework by default, or you can configure it
|
|
4
|
+
explicitly.
|
|
5
5
|
|
|
6
|
-
Scenario:
|
|
7
|
-
Given a file named "
|
|
6
|
+
Scenario: passing message expectation
|
|
7
|
+
Given a file named "example_spec.rb" with:
|
|
8
8
|
"""
|
|
9
9
|
RSpec.configure do |config|
|
|
10
10
|
config.mock_framework = :rspec
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
describe "
|
|
14
|
-
it "
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
describe "mocking with RSpec" do
|
|
14
|
+
it "passes when it should" do
|
|
15
|
+
receiver = double('receiver')
|
|
16
|
+
receiver.should_receive(:message)
|
|
17
|
+
receiver.message
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
"""
|
|
21
|
-
When I run
|
|
21
|
+
When I run `rspec example_spec.rb`
|
|
22
22
|
Then the examples should all pass
|
|
23
|
+
|
|
24
|
+
Scenario: failing message expecation
|
|
25
|
+
Given a file named "example_spec.rb" with:
|
|
26
|
+
"""
|
|
27
|
+
RSpec.configure do |config|
|
|
28
|
+
config.mock_framework = :rspec
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe "mocking with RSpec" do
|
|
32
|
+
it "fails when it should" do
|
|
33
|
+
receiver = double('receiver')
|
|
34
|
+
receiver.should_receive(:message)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
"""
|
|
38
|
+
When I run `rspec example_spec.rb`
|
|
39
|
+
Then the output should contain "1 example, 1 failure"
|
|
40
|
+
|
|
41
|
+
Scenario: failing message expectation in pending block (remains pending)
|
|
42
|
+
Given a file named "example_spec.rb" with:
|
|
43
|
+
"""
|
|
44
|
+
RSpec.configure do |config|
|
|
45
|
+
config.mock_framework = :rspec
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
describe "failed message expectation in a pending block" do
|
|
49
|
+
it "is listed as pending" do
|
|
50
|
+
pending do
|
|
51
|
+
receiver = double('receiver')
|
|
52
|
+
receiver.should_receive(:message)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
"""
|
|
57
|
+
When I run `rspec example_spec.rb`
|
|
58
|
+
Then the output should contain "1 example, 0 failures, 1 pending"
|
|
23
59
|
And the exit status should be 0
|
|
60
|
+
|
|
61
|
+
Scenario: passing message expectation in pending block (fails)
|
|
62
|
+
Given a file named "example_spec.rb" with:
|
|
63
|
+
"""
|
|
64
|
+
RSpec.configure do |config|
|
|
65
|
+
config.mock_framework = :rspec
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
describe "passing message expectation in a pending block" do
|
|
69
|
+
it "fails with FIXED" do
|
|
70
|
+
pending do
|
|
71
|
+
receiver = double('receiver')
|
|
72
|
+
receiver.should_receive(:message)
|
|
73
|
+
receiver.message
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
"""
|
|
78
|
+
When I run `rspec example_spec.rb`
|
|
79
|
+
Then the output should contain "FIXED"
|
|
80
|
+
Then the output should contain "1 example, 1 failure"
|
|
81
|
+
And the exit status should be 1
|
|
82
|
+
|
|
83
|
+
Scenario: accessing RSpec.configuration.mock_framework.framework_name
|
|
84
|
+
Given a file named "example_spec.rb" with:
|
|
85
|
+
"""
|
|
86
|
+
RSpec.configure do |config|
|
|
87
|
+
config.mock_framework = :rspec
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
describe "RSpec.configuration.mock_framework.framework_name" do
|
|
91
|
+
it "returns :rspec" do
|
|
92
|
+
RSpec.configuration.mock_framework.framework_name.should eq(:rspec)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
"""
|
|
96
|
+
When I run `rspec example_spec.rb`
|
|
97
|
+
Then the examples should all pass
|
|
@@ -10,7 +10,7 @@ Feature: pending examples
|
|
|
10
10
|
it "is a pending example"
|
|
11
11
|
end
|
|
12
12
|
"""
|
|
13
|
-
When I run
|
|
13
|
+
When I run `rspec example_without_block_spec.rb`
|
|
14
14
|
Then the exit status should be 0
|
|
15
15
|
And the output should contain "1 example, 0 failures, 1 pending"
|
|
16
16
|
And the output should contain "Not Yet Implemented"
|
|
@@ -26,7 +26,7 @@ Feature: pending examples
|
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
"""
|
|
29
|
-
When I run
|
|
29
|
+
When I run `rspec pending_without_block_spec.rb`
|
|
30
30
|
Then the exit status should be 0
|
|
31
31
|
And the output should contain "1 example, 0 failures, 1 pending"
|
|
32
32
|
And the output should contain:
|
|
@@ -48,7 +48,7 @@ Feature: pending examples
|
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
"""
|
|
51
|
-
When I run
|
|
51
|
+
When I run `rspec pending_with_failing_block_spec.rb`
|
|
52
52
|
Then the exit status should be 0
|
|
53
53
|
And the output should contain "1 example, 0 failures, 1 pending"
|
|
54
54
|
And the output should contain:
|
|
@@ -70,7 +70,7 @@ Feature: pending examples
|
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
"""
|
|
73
|
-
When I run
|
|
73
|
+
When I run `rspec pending_with_passing_block_spec.rb`
|
|
74
74
|
Then the exit status should not be 0
|
|
75
75
|
And the output should contain "1 example, 1 failure"
|
|
76
76
|
And the output should contain "FIXED"
|
|
@@ -86,7 +86,7 @@ Feature: pending examples
|
|
|
86
86
|
end
|
|
87
87
|
end
|
|
88
88
|
"""
|
|
89
|
-
When I run
|
|
89
|
+
When I run `rspec pending_with_xit_spec.rb`
|
|
90
90
|
Then the exit status should be 0
|
|
91
91
|
And the output should contain "1 example, 0 failures, 1 pending"
|
|
92
92
|
And the output should contain:
|
|
@@ -107,7 +107,7 @@ Feature: pending examples
|
|
|
107
107
|
end
|
|
108
108
|
end
|
|
109
109
|
"""
|
|
110
|
-
When I run
|
|
110
|
+
When I run `rspec pending_with_no_docstring_spec.rb --format documentation`
|
|
111
111
|
Then the exit status should be 0
|
|
112
112
|
And the output should contain "2 examples, 0 failures, 1 pending"
|
|
113
113
|
And the output should contain:
|
|
@@ -129,7 +129,7 @@ Feature: pending examples
|
|
|
129
129
|
end
|
|
130
130
|
end
|
|
131
131
|
"""
|
|
132
|
-
When I run
|
|
132
|
+
When I run `rspec pending_with_no_docstring_spec.rb --format documentation`
|
|
133
133
|
Then the exit status should be 0
|
|
134
134
|
And the output should contain "2 examples, 0 failures, 1 pending"
|
|
135
135
|
And the output should contain:
|
|
@@ -182,7 +182,7 @@ Feature: pending examples
|
|
|
182
182
|
end
|
|
183
183
|
end
|
|
184
184
|
"""
|
|
185
|
-
When I run
|
|
185
|
+
When I run `rspec ./conditionally_pending_spec.rb`
|
|
186
186
|
Then the output should contain "8 examples, 4 failures, 2 pending"
|
|
187
187
|
And the output should contain:
|
|
188
188
|
"""
|
|
@@ -6,7 +6,7 @@ end
|
|
|
6
6
|
|
|
7
7
|
Then /^the output should not contain any of these:$/ do |table|
|
|
8
8
|
table.raw.flatten.each do |string|
|
|
9
|
-
|
|
9
|
+
all_output.should_not =~ regexp(string)
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
@@ -18,3 +18,13 @@ end
|
|
|
18
18
|
Then /^the file "([^"]*)" should contain:$/ do |file, partial_content|
|
|
19
19
|
check_file_content(file, partial_content, true)
|
|
20
20
|
end
|
|
21
|
+
|
|
22
|
+
Then /^the backtrace\-normalized output should contain:$/ do |partial_output|
|
|
23
|
+
# ruby 1.9 includes additional stuff in the backtrace,
|
|
24
|
+
# so we need to normalize it to compare it with our expected output.
|
|
25
|
+
normalized_output = all_output.split("\n").map do |line|
|
|
26
|
+
line =~ /(^\s+# [^:]+:\d+)/ ? $1 : line # http://rubular.com/r/zDD7DdWyzF
|
|
27
|
+
end.join("\n")
|
|
28
|
+
|
|
29
|
+
normalized_output.should =~ regexp(partial_output)
|
|
30
|
+
end
|
|
@@ -28,7 +28,7 @@ Feature: attribute of subject
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
"""
|
|
31
|
-
When I run
|
|
31
|
+
When I run `rspec example_spec.rb --format documentation`
|
|
32
32
|
Then the output should contain:
|
|
33
33
|
"""
|
|
34
34
|
Array
|
|
@@ -59,7 +59,7 @@ Feature: attribute of subject
|
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
"""
|
|
62
|
-
When I run
|
|
62
|
+
When I run `rspec example_spec.rb --format documentation`
|
|
63
63
|
Then the output should contain:
|
|
64
64
|
"""
|
|
65
65
|
Person
|
|
@@ -81,7 +81,7 @@ Feature: attribute of subject
|
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
83
|
"""
|
|
84
|
-
When I run
|
|
84
|
+
When I run `rspec example_spec.rb`
|
|
85
85
|
Then the examples should all pass
|
|
86
86
|
|
|
87
87
|
Scenario: specify value for key in a hash
|
|
@@ -98,5 +98,25 @@ Feature: attribute of subject
|
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
100
|
"""
|
|
101
|
-
When I run
|
|
101
|
+
When I run `rspec example_spec.rb`
|
|
102
|
+
Then the examples should all pass
|
|
103
|
+
|
|
104
|
+
Scenario: specify value for key in a hash-like object
|
|
105
|
+
Given a file named "example_spec.rb" with:
|
|
106
|
+
"""
|
|
107
|
+
require 'matrix'
|
|
108
|
+
|
|
109
|
+
describe Matrix do
|
|
110
|
+
context "with values [[1, 2], [3, 4]]" do
|
|
111
|
+
subject do
|
|
112
|
+
Matrix[[1, 2], [3, 4]]
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
its([0, 1]) { should eq(2) }
|
|
116
|
+
its([1, 0]) { should eq(3) }
|
|
117
|
+
its([1, 2]) { should be_nil }
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
"""
|
|
121
|
+
When I run `rspec example_spec.rb`
|
|
102
122
|
Then the examples should all pass
|
|
@@ -13,7 +13,7 @@ Feature: explicit subject
|
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
"""
|
|
16
|
-
When I run
|
|
16
|
+
When I run `rspec top_level_subject_spec.rb`
|
|
17
17
|
Then the examples should all pass
|
|
18
18
|
|
|
19
19
|
Scenario: subject in a nested group
|
|
@@ -28,7 +28,7 @@ Feature: explicit subject
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
"""
|
|
31
|
-
When I run
|
|
31
|
+
When I run `rspec nested_subject_spec.rb`
|
|
32
32
|
Then the examples should all pass
|
|
33
33
|
|
|
34
34
|
Scenario: access subject from before block
|
|
@@ -42,7 +42,7 @@ Feature: explicit subject
|
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
"""
|
|
45
|
-
When I run
|
|
45
|
+
When I run `rspec top_level_subject_spec.rb`
|
|
46
46
|
Then the examples should all pass
|
|
47
47
|
|
|
48
48
|
Scenario: invoke helper method from subject block
|
|
@@ -58,7 +58,7 @@ Feature: explicit subject
|
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
"""
|
|
61
|
-
When I run
|
|
61
|
+
When I run `rspec helper_subject_spec.rb`
|
|
62
62
|
Then the examples should all pass
|
|
63
63
|
|
|
64
64
|
Scenario: subject block is invoked at most once per example
|
|
@@ -74,5 +74,5 @@ Feature: explicit subject
|
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
76
|
"""
|
|
77
|
-
When I run
|
|
77
|
+
When I run `rspec nil_subject_spec.rb`
|
|
78
78
|
Then the examples should all pass
|
|
@@ -12,7 +12,7 @@ Feature: implicit receiver
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
"""
|
|
15
|
-
When I run
|
|
15
|
+
When I run `rspec example_spec.rb`
|
|
16
16
|
Then the examples should all pass
|
|
17
17
|
|
|
18
18
|
Scenario: explicit subject
|
|
@@ -25,5 +25,5 @@ Feature: implicit receiver
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
"""
|
|
28
|
-
When I run
|
|
28
|
+
When I run `rspec example_spec.rb`
|
|
29
29
|
Then the examples should all pass
|
|
@@ -12,7 +12,7 @@ Feature: implicit subject
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
"""
|
|
15
|
-
When I run
|
|
15
|
+
When I run `rspec ./top_level_subject_spec.rb`
|
|
16
16
|
Then the examples should all pass
|
|
17
17
|
|
|
18
18
|
Scenario: subject in a nested group
|
|
@@ -26,5 +26,5 @@ Feature: implicit subject
|
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
"""
|
|
29
|
-
When I run
|
|
29
|
+
When I run `rspec nested_subject_spec.rb`
|
|
30
30
|
Then the examples should all pass
|
data/features/support/env.rb
CHANGED
|
@@ -17,7 +17,12 @@ be removed from a future version of RSpec.
|
|
|
17
17
|
WARNING
|
|
18
18
|
RSpec
|
|
19
19
|
else
|
|
20
|
-
|
|
20
|
+
begin
|
|
21
|
+
super
|
|
22
|
+
rescue Exception => e
|
|
23
|
+
e.backtrace.reject! {|l| l =~ Regexp.compile(__FILE__) }
|
|
24
|
+
raise e
|
|
25
|
+
end
|
|
21
26
|
end
|
|
22
27
|
end
|
|
23
28
|
end
|
|
@@ -38,7 +43,12 @@ WARNING
|
|
|
38
43
|
require 'rspec/core/rake_task'
|
|
39
44
|
RSpec::Core::RakeTask
|
|
40
45
|
else
|
|
41
|
-
|
|
46
|
+
begin
|
|
47
|
+
super
|
|
48
|
+
rescue Exception => e
|
|
49
|
+
e.backtrace.reject! {|l| l =~ Regexp.compile(__FILE__) }
|
|
50
|
+
raise e
|
|
51
|
+
end
|
|
42
52
|
end
|
|
43
53
|
end
|
|
44
54
|
|
|
@@ -16,15 +16,12 @@ module RSpec
|
|
|
16
16
|
@configuration.output_stream ||= out
|
|
17
17
|
@options.configure(@configuration)
|
|
18
18
|
@configuration.load_spec_files
|
|
19
|
-
@
|
|
20
|
-
@configuration.configure_expectation_framework
|
|
21
|
-
@world.announce_inclusion_filter
|
|
22
|
-
@world.announce_exclusion_filter
|
|
19
|
+
@world.announce_filters
|
|
23
20
|
|
|
24
21
|
@configuration.reporter.report(@world.example_count) do |reporter|
|
|
25
22
|
begin
|
|
26
23
|
@configuration.run_hook(:before, :suite)
|
|
27
|
-
@world.example_groups.map {|g| g.run(reporter)}.all?
|
|
24
|
+
@world.example_groups.map {|g| g.run(reporter)}.all? ? 0 : 1
|
|
28
25
|
ensure
|
|
29
26
|
@configuration.run_hook(:after, :suite)
|
|
30
27
|
end
|