rspec-core 2.5.2 → 2.6.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -0
- data/Gemfile +10 -13
- data/README.md +4 -1
- data/Rakefile +29 -12
- data/cucumber.yml +1 -1
- data/features/.nav +10 -4
- data/features/Autotest.md +31 -7
- data/features/Changelog.md +36 -6
- 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 +26 -10
- 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 +1 -1
- data/features/formatters/custom_formatter.feature +1 -1
- data/features/formatters/text_formatter.feature +45 -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 +11 -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.rb +22 -0
- data/lib/rspec/core/backward_compatibility.rb +12 -2
- data/lib/rspec/core/command_line.rb +1 -4
- data/lib/rspec/core/configuration.rb +25 -17
- 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 +36 -4
- 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 +5 -2
- data/lib/rspec/core/pending.rb +10 -3
- data/lib/rspec/core/reporter.rb +2 -2
- data/lib/rspec/core/runner.rb +7 -1
- 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 +16 -4
- data/rspec-core.gemspec +4 -3
- data/spec.txt +1126 -0
- data/spec/autotest/failed_results_re_spec.rb +2 -2
- data/spec/rspec/core/command_line_spec.rb +0 -2
- data/spec/rspec/core/configuration_spec.rb +84 -1
- data/spec/rspec/core/deprecations_spec.rb +21 -0
- data/spec/rspec/core/drb_command_line_spec.rb +3 -11
- 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 +8 -0
- 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 +35 -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 +38 -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
- metadata +39 -16
@@ -0,0 +1,17 @@
|
|
1
|
+
Feature: current example
|
2
|
+
|
3
|
+
You can reference the example object, and access its metadata, using
|
4
|
+
the `example` method within an example.
|
5
|
+
|
6
|
+
Scenario: access the example object from within an example
|
7
|
+
Given a file named "spec/example_spec.rb" with:
|
8
|
+
"""
|
9
|
+
describe "an example" do
|
10
|
+
it "knows itself as example" do
|
11
|
+
example.description.should eq("knows itself as example")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
"""
|
15
|
+
When I run `rspec spec/example_spec.rb`
|
16
|
+
Then the example should pass
|
17
|
+
|
@@ -0,0 +1,111 @@
|
|
1
|
+
Feature: User-defined metadata
|
2
|
+
|
3
|
+
You can attach user-defined metadata to any example group or example.
|
4
|
+
Pass a hash as the last argument (before the block) to `describe`,
|
5
|
+
`context` or `it`. RSpec supports many configuration options that apply
|
6
|
+
only to certain examples or groups based on the metadata.
|
7
|
+
|
8
|
+
Metadata defined on an example group is available (and can be overriden)
|
9
|
+
by any sub-group or from any example in that group or a sub-group.
|
10
|
+
|
11
|
+
In addition, there is a configuration option (which will be the default
|
12
|
+
behavior in RSpec 3) that allows you to specify metadata using just
|
13
|
+
symbols:
|
14
|
+
|
15
|
+
RSpec.configure do |c|
|
16
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
17
|
+
end
|
18
|
+
|
19
|
+
Each symbol passed as an argument to `describe`, `context` or `it` will
|
20
|
+
be a key in the metadata hash, with a corresponding value of `true`.
|
21
|
+
|
22
|
+
Scenario: define group metadata using a hash
|
23
|
+
Given a file named "define_group_metadata_with_hash_spec.rb" with:
|
24
|
+
"""
|
25
|
+
describe "a group with user-defined metadata", :foo => 17 do
|
26
|
+
it 'has access to the metadata in the example' do
|
27
|
+
example.metadata[:foo].should == 17
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'does not have access to metadata defined on sub-groups' do
|
31
|
+
example.metadata.should_not include(:bar)
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'a sub-group with user-defined metadata', :bar => 12 do
|
35
|
+
it 'has access to the sub-group metadata' do
|
36
|
+
example.metadata[:foo].should == 17
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'also has access to metadata defined on parent groups' do
|
40
|
+
example.metadata[:bar].should == 12
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
"""
|
45
|
+
When I run `rspec define_group_metadata_with_hash_spec.rb`
|
46
|
+
Then the examples should all pass
|
47
|
+
|
48
|
+
Scenario: define example metadata using a hash
|
49
|
+
Given a file named "define_example_metadata_with_hash_spec.rb" with:
|
50
|
+
"""
|
51
|
+
describe "a group with no user-defined metadata" do
|
52
|
+
it 'has an example with metadata', :foo => 17 do
|
53
|
+
example.metadata[:foo].should == 17
|
54
|
+
example.metadata.should_not include(:bar)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'has another example with metadata', :bar => 12, :bazz => 33 do
|
58
|
+
example.metadata[:bar].should == 12
|
59
|
+
example.metadata[:bazz].should == 33
|
60
|
+
example.metadata.should_not include(:foo)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
"""
|
64
|
+
When I run `rspec define_example_metadata_with_hash_spec.rb`
|
65
|
+
Then the examples should all pass
|
66
|
+
|
67
|
+
Scenario: override user-defined metadata
|
68
|
+
Given a file named "override_metadata_spec.rb" with:
|
69
|
+
"""
|
70
|
+
describe "a group with user-defined metadata", :foo => 'bar' do
|
71
|
+
it 'can be overriden by an example', :foo => 'bazz' do
|
72
|
+
example.metadata[:foo].should == 'bazz'
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "a sub-group with an override", :foo => 'goo' do
|
76
|
+
it 'can be overriden by a sub-group' do
|
77
|
+
example.metadata[:foo].should == 'goo'
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
"""
|
82
|
+
When I run `rspec override_metadata_spec.rb`
|
83
|
+
Then the examples should all pass
|
84
|
+
|
85
|
+
Scenario: less verbose metadata
|
86
|
+
Given a file named "less_verbose_metadata_spec.rb" with:
|
87
|
+
"""
|
88
|
+
RSpec.configure do |c|
|
89
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "a group with simple metadata", :fast, :simple, :bug => 73 do
|
93
|
+
it 'has `:fast => true` metadata' do
|
94
|
+
example.metadata[:fast].should == true
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'has `:simple => true` metadata' do
|
98
|
+
example.metadata[:simple].should == true
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'can still use a hash for metadata' do
|
102
|
+
example.metadata[:bug].should == 73
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'can define simple metadata on an example', :special do
|
106
|
+
example.metadata[:special].should == true
|
107
|
+
end
|
108
|
+
end
|
109
|
+
"""
|
110
|
+
When I run `rspec less_verbose_metadata_spec.rb`
|
111
|
+
Then the examples should all pass
|
@@ -100,7 +100,7 @@ Feature: mock with an alternative framework
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
"""
|
103
|
-
When I run
|
103
|
+
When I run `rspec example_spec.rb --format doc`
|
104
104
|
Then the exit status should be 1
|
105
105
|
And the output should contain "2 examples, 1 failure"
|
106
106
|
And the output should contain "fails when message is received (FAILED - 1)"
|
@@ -1,23 +1,96 @@
|
|
1
1
|
Feature: mock with flexmock
|
2
2
|
|
3
|
-
|
4
|
-
I want to be able to use flexmock
|
3
|
+
Configure RSpec to use flexmock 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 = :flexmock
|
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 = flexmock('receiver')
|
15
|
+
receiver.should_receive(: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 = :flexmock
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "mocking with RSpec" do
|
31
|
+
it "fails when it should" do
|
32
|
+
receiver = flexmock('receiver')
|
33
|
+
receiver.should_receive(: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 = :flexmock
|
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 = flexmock('receiver')
|
51
|
+
receiver.should_receive(: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 = :flexmock
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "passing message expectation in a pending block" do
|
68
|
+
it "fails with FIXED" do
|
69
|
+
pending do
|
70
|
+
receiver = flexmock('receiver')
|
71
|
+
receiver.should_receive(: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 = :flexmock
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "RSpec.configuration.mock_framework.framework_name" do
|
90
|
+
it "returns :flexmock" do
|
91
|
+
RSpec.configuration.mock_framework.framework_name.should eq(:flexmock)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
"""
|
95
|
+
When I run `rspec example_spec.rb`
|
96
|
+
Then the examples should all pass
|
@@ -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
|
+
|