rspec-core 2.6.4 → 2.7.0.rc1
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/README.md +1 -1
- data/{bin → exe}/autospec +0 -0
- data/{bin → exe}/rspec +0 -0
- data/features/Upgrade.md +11 -0
- data/features/command_line/exit_status.feature +20 -3
- data/features/command_line/format_option.feature +8 -0
- data/features/command_line/line_number_appended_to_path.feature +35 -1
- data/features/command_line/line_number_option.feature +16 -3
- data/features/command_line/pattern_option.feature +31 -0
- data/features/command_line/rake_task.feature +1 -1
- data/features/command_line/ruby.feature +22 -0
- data/features/configuration/default_path.feature +38 -0
- data/features/example_groups/{shared_example_group.feature → shared_examples.feature} +49 -26
- data/features/expectation_framework_integration/configure_expectation_framework.feature +1 -1
- data/features/filtering/inclusion_filters.feature +4 -5
- data/features/formatters/text_formatter.feature +16 -13
- data/features/helper_methods/let.feature +4 -4
- data/features/hooks/around_hooks.feature +1 -1
- data/features/hooks/before_and_after_hooks.feature +3 -3
- data/features/hooks/filtering.feature +13 -6
- data/features/metadata/user_defined.feature +12 -10
- data/features/pending/pending_examples.feature +21 -8
- data/features/step_definitions/additional_cli_steps.rb +1 -1
- data/features/subject/attribute_of_subject.feature +2 -2
- data/features/support/env.rb +1 -2
- data/lib/rspec/core.rb +1 -23
- data/lib/rspec/core/configuration.rb +64 -16
- data/lib/rspec/core/configuration_options.rb +11 -4
- data/lib/rspec/core/example.rb +10 -7
- data/lib/rspec/core/example_group.rb +34 -18
- data/lib/rspec/core/formatters/base_text_formatter.rb +10 -2
- data/lib/rspec/core/formatters/html_formatter.rb +3 -1
- data/lib/rspec/core/formatters/snippet_extractor.rb +9 -3
- data/lib/rspec/core/formatters/text_mate_formatter.rb +20 -6
- data/lib/rspec/core/hooks.rb +2 -2
- data/lib/rspec/core/let.rb +5 -5
- data/lib/rspec/core/metadata.rb +136 -94
- data/lib/rspec/core/option_parser.rb +10 -5
- data/lib/rspec/core/pending.rb +2 -1
- data/lib/rspec/core/rake_task.rb +26 -15
- data/lib/rspec/core/reporter.rb +2 -3
- data/lib/rspec/core/runner.rb +1 -1
- data/lib/rspec/core/shared_example_group.rb +4 -4
- data/lib/rspec/core/subject.rb +7 -7
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +4 -8
- data/spec/autotest/discover_spec.rb +2 -2
- data/spec/autotest/failed_results_re_spec.rb +29 -21
- data/spec/autotest/rspec_spec.rb +3 -3
- data/spec/rspec/core/command_line_spec.rb +1 -6
- data/spec/rspec/core/configuration_options_spec.rb +65 -13
- data/spec/rspec/core/configuration_spec.rb +148 -37
- data/spec/rspec/core/deprecations_spec.rb +2 -2
- data/spec/rspec/core/drb_command_line_spec.rb +6 -6
- data/spec/rspec/core/example_group_spec.rb +197 -61
- data/spec/rspec/core/example_spec.rb +33 -16
- data/spec/rspec/core/formatters/base_formatter_spec.rb +3 -3
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +149 -1
- data/spec/rspec/core/formatters/helpers_spec.rb +8 -8
- data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +85 -17
- data/spec/rspec/core/formatters/html_formatted-1.8.7.html +12 -11
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +12 -11
- data/spec/rspec/core/formatters/{html_formatted-1.9.1.html → html_formatted-1.9.3.html} +12 -11
- data/spec/rspec/core/formatters/html_formatter_spec.rb +5 -5
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +2 -2
- data/spec/rspec/core/formatters/snippet_extractor_spec.rb +2 -2
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +86 -18
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +13 -12
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +29 -28
- data/spec/rspec/core/formatters/{text_mate_formatted-1.9.1.html → text_mate_formatted-1.9.3.html} +29 -28
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +2 -2
- data/spec/rspec/core/hooks_filtering_spec.rb +18 -18
- data/spec/rspec/core/let_spec.rb +19 -6
- data/spec/rspec/core/metadata_spec.rb +146 -61
- data/spec/rspec/core/pending_example_spec.rb +4 -4
- data/spec/rspec/core/rake_task_spec.rb +71 -50
- data/spec/rspec/core/reporter_spec.rb +2 -2
- data/spec/rspec/core/ruby_project_spec.rb +2 -2
- data/spec/rspec/core/runner_spec.rb +4 -1
- data/spec/rspec/core/shared_example_group_spec.rb +15 -119
- data/spec/rspec/core/subject_spec.rb +13 -13
- data/spec/rspec/core/world_spec.rb +31 -22
- data/spec/rspec/core_spec.rb +1 -29
- data/spec/spec_helper.rb +51 -49
- data/spec/support/shared_example_groups.rb +3 -3
- data/spec/support/spec_files.rb +8 -8
- metadata +79 -93
- data/.document +0 -5
- data/.gitignore +0 -12
- data/.rspec +0 -0
- data/.travis.yml +0 -9
- data/Changelog.md +0 -305
- data/Gemfile +0 -49
- data/Guardfile +0 -5
- data/License.txt +0 -23
- data/Rakefile +0 -93
- data/cucumber.yml +0 -2
- data/features/.nav +0 -57
- data/rspec-core.gemspec +0 -24
- data/script/FullBuildRakeFile +0 -63
- data/script/console +0 -8
- data/script/cucumber +0 -1
- data/script/full_build +0 -1
- data/script/spec +0 -1
- data/spec.txt +0 -1126
- data/spec/rspec/core/formatters/html_formatted-1.8.6.html +0 -398
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.6.html +0 -398
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
RSpec Core provides the structure for writing executable examples of how your
|
|
4
4
|
code should behave.
|
|
5
5
|
|
|
6
|
-
[](http://travis-ci.org/rspec/rspec-core)
|
|
7
7
|
|
|
8
8
|
## Documentation
|
|
9
9
|
|
data/{bin → exe}/autospec
RENAMED
|
File without changes
|
data/{bin → exe}/rspec
RENAMED
|
File without changes
|
data/features/Upgrade.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# rspec-core-2.7 (not yet released - coming soon)
|
|
2
|
+
|
|
3
|
+
## `--default_path`
|
|
4
|
+
|
|
5
|
+
Add the following to `.rspec`:
|
|
6
|
+
|
|
7
|
+
# in .rspec
|
|
8
|
+
--default_path spec
|
|
9
|
+
|
|
10
|
+
And now you can just type `rspec` to run all the specs in the `spec` directory.
|
|
11
|
+
|
|
1
12
|
# rspec-core-2.6
|
|
2
13
|
|
|
3
14
|
## new APIs for sharing content
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Feature: exit status
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
The rspec command exits with an exit status of 0 if all examples pass,
|
|
4
|
+
and 1 if any examples fail.
|
|
5
5
|
|
|
6
6
|
Scenario: exit with 0 when all examples pass
|
|
7
7
|
Given a file named "ok_spec.rb" with:
|
|
@@ -42,7 +42,7 @@ Feature: exit status
|
|
|
42
42
|
When I run `rspec nested_ko_spec.rb`
|
|
43
43
|
Then the exit status should be 1
|
|
44
44
|
And the output should contain "1 example, 1 failure"
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
Scenario: exit with 0 when no examples are run
|
|
47
47
|
Given a file named "a_no_examples_spec.rb" with:
|
|
48
48
|
"""
|
|
@@ -50,3 +50,20 @@ Feature: exit status
|
|
|
50
50
|
When I run `rspec a_no_examples_spec.rb`
|
|
51
51
|
Then the exit status should be 0
|
|
52
52
|
And the output should contain "0 examples"
|
|
53
|
+
|
|
54
|
+
@wip
|
|
55
|
+
Scenario: exit with rspec's exit code when an at_exit hook is added upstream
|
|
56
|
+
Given a file named "exit_at_spec.rb" with:
|
|
57
|
+
"""
|
|
58
|
+
require 'rspec/autorun'
|
|
59
|
+
|
|
60
|
+
describe "exit 0 at_exit" do
|
|
61
|
+
it "does not interfere with rspec's exit code" do
|
|
62
|
+
at_exit { exit 0 }
|
|
63
|
+
fail
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
"""
|
|
67
|
+
When I run `rspec exit_at_spec.rb`
|
|
68
|
+
Then the exit status should be 1
|
|
69
|
+
And the output should contain "1 example, 1 failure"
|
|
@@ -19,6 +19,14 @@ Feature: --format option
|
|
|
19
19
|
|
|
20
20
|
$ rspec spec --format documentation:rspec.output.txt
|
|
21
21
|
|
|
22
|
+
`rspec --help` lists available formatters:
|
|
23
|
+
|
|
24
|
+
[p]rogress (default - dots)
|
|
25
|
+
[d]ocumentation (group and example names)
|
|
26
|
+
[h]tml
|
|
27
|
+
[t]extmate
|
|
28
|
+
custom formatter class name
|
|
29
|
+
|
|
22
30
|
Background:
|
|
23
31
|
Given a file named "example_spec.rb" with:
|
|
24
32
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Feature: line number appended to file path
|
|
2
2
|
|
|
3
|
-
To run
|
|
3
|
+
To run one or more examples or groups, you can append the line number to the path, e.g.
|
|
4
4
|
|
|
5
5
|
rspec path/to/example_spec.rb:37
|
|
6
6
|
|
|
@@ -27,6 +27,15 @@ Feature: line number appended to file path
|
|
|
27
27
|
|
|
28
28
|
end
|
|
29
29
|
"""
|
|
30
|
+
And a file named "example2_spec.rb" with:
|
|
31
|
+
"""
|
|
32
|
+
describe "yet another group" do
|
|
33
|
+
it "first example in second file" do
|
|
34
|
+
end
|
|
35
|
+
it "second example in second file" do
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
"""
|
|
30
39
|
|
|
31
40
|
Scenario: nested groups - outer group on declaration line
|
|
32
41
|
When I run `rspec example_spec.rb:1 --format doc`
|
|
@@ -104,3 +113,28 @@ Feature: line number appended to file path
|
|
|
104
113
|
And the output should contain "second example in outer group"
|
|
105
114
|
But the output should not contain "first example in outer group"
|
|
106
115
|
And the output should not contain "example in nested group"
|
|
116
|
+
|
|
117
|
+
Scenario: specified multiple times for different files
|
|
118
|
+
When I run `rspec example_spec.rb:7 example2_spec.rb:4 --format doc`
|
|
119
|
+
Then the examples should all pass
|
|
120
|
+
And the output should contain "second example in outer group"
|
|
121
|
+
And the output should contain "second example in second file"
|
|
122
|
+
But the output should not contain "first example in outer group"
|
|
123
|
+
And the output should not contain "nested group"
|
|
124
|
+
And the output should not contain "first example in second file"
|
|
125
|
+
|
|
126
|
+
Scenario: specified multiple times for the same file with multiple arguments
|
|
127
|
+
When I run `rspec example_spec.rb:7 example_spec.rb:11 --format doc`
|
|
128
|
+
Then the examples should all pass
|
|
129
|
+
And the output should contain "second example in outer group"
|
|
130
|
+
And the output should contain "nested group"
|
|
131
|
+
But the output should not contain "first example in outer group"
|
|
132
|
+
And the output should not contain "second file"
|
|
133
|
+
|
|
134
|
+
Scenario: specified multiple times for the same file with a single argument
|
|
135
|
+
When I run `rspec example_spec.rb:7:11 --format doc`
|
|
136
|
+
Then the examples should all pass
|
|
137
|
+
And the output should contain "second example in outer group"
|
|
138
|
+
And the output should contain "nested group"
|
|
139
|
+
But the output should not contain "first example in outer group"
|
|
140
|
+
And the output should not contain "second file"
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
Feature: --line_number option
|
|
2
2
|
|
|
3
|
-
To run a
|
|
3
|
+
To run a examples or groups by line numbers, one can use the --line_number option:
|
|
4
4
|
|
|
5
5
|
rspec path/to/example_spec.rb --line_number 37
|
|
6
6
|
|
|
7
|
+
This option can be specified multiple times.
|
|
8
|
+
|
|
7
9
|
Scenario: standard examples
|
|
8
10
|
Given a file named "example_spec.rb" with:
|
|
9
11
|
"""
|
|
@@ -18,13 +20,24 @@ Feature: --line_number option
|
|
|
18
20
|
it "should be < 10" do
|
|
19
21
|
9.should be < 10
|
|
20
22
|
end
|
|
21
|
-
|
|
23
|
+
|
|
24
|
+
it "should be 3 squared" do
|
|
25
|
+
9.should be 3*3
|
|
26
|
+
end
|
|
27
|
+
|
|
22
28
|
end
|
|
23
29
|
"""
|
|
24
30
|
When I run `rspec example_spec.rb --line_number 5 --format doc`
|
|
25
31
|
Then the examples should all pass
|
|
26
|
-
|
|
32
|
+
And the output should contain "should be > 8"
|
|
27
33
|
But the output should not contain "should be < 10"
|
|
34
|
+
And the output should not contain "should be 3*3"
|
|
35
|
+
|
|
36
|
+
When I run `rspec example_spec.rb --line_number 5 --line_number 9 --format doc`
|
|
37
|
+
Then the examples should all pass
|
|
38
|
+
And the output should contain "should be > 8"
|
|
39
|
+
And the output should contain "should be < 10"
|
|
40
|
+
But the output should not contain "should be 3*3"
|
|
28
41
|
|
|
29
42
|
Scenario: one liner
|
|
30
43
|
Given a file named "example_spec.rb" with:
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Feature: pattern option
|
|
2
|
+
|
|
3
|
+
By default, RSpec loads files matching the pattern:
|
|
4
|
+
|
|
5
|
+
"spec/**/*_spec.rb"
|
|
6
|
+
|
|
7
|
+
Use the `--pattern` option to declare a different pattern.
|
|
8
|
+
|
|
9
|
+
Scenario: default pattern
|
|
10
|
+
Given a file named "spec/example_spec.rb" with:
|
|
11
|
+
"""
|
|
12
|
+
describe "addition" do
|
|
13
|
+
it "adds things" do
|
|
14
|
+
(1 + 2).should eq(3)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
"""
|
|
18
|
+
When I run `rspec`
|
|
19
|
+
Then the output should contain "1 example, 0 failures"
|
|
20
|
+
|
|
21
|
+
Scenario: override the default pattern on the command line
|
|
22
|
+
Given a file named "spec/example.spec" with:
|
|
23
|
+
"""
|
|
24
|
+
describe "addition" do
|
|
25
|
+
it "adds things" do
|
|
26
|
+
(1 + 2).should eq(3)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
"""
|
|
30
|
+
When I run `rspec --pattern "spec/**/*.spec"`
|
|
31
|
+
Then the output should contain "1 example, 0 failures"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Feature: run with ruby command
|
|
2
|
+
|
|
3
|
+
You can use the `ruby` command to run specs. You just need to require
|
|
4
|
+
`rspec/autorun`.
|
|
5
|
+
|
|
6
|
+
Generally speaking, you're better off using the `rspec` command, which
|
|
7
|
+
requires `rspec/autorun` for you, but some tools only work with the `ruby`
|
|
8
|
+
command.
|
|
9
|
+
|
|
10
|
+
Scenario:
|
|
11
|
+
Given a file named "example_spec.rb" with:
|
|
12
|
+
"""
|
|
13
|
+
require 'rspec/autorun'
|
|
14
|
+
|
|
15
|
+
describe 1 do
|
|
16
|
+
it "is < 2" do
|
|
17
|
+
1.should be < 2
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
"""
|
|
21
|
+
When I run `ruby example_spec.rb`
|
|
22
|
+
Then the output should contain "1 example, 0 failures"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Feature: default_path
|
|
2
|
+
|
|
3
|
+
As of rspec-2.7 (not yet released), you can just type `rspec` to run all
|
|
4
|
+
specs that live in the `spec` directory.
|
|
5
|
+
|
|
6
|
+
This is supported by a `--default_path` option, which is set to `spec` by
|
|
7
|
+
default. If you prefer to keep your specs in a different directory, or assign
|
|
8
|
+
an individual file to `--default_path`, you can do so on the command line or
|
|
9
|
+
in a configuration file (`.rspec`, `~/.rspec`, or a custom file).
|
|
10
|
+
|
|
11
|
+
NOTE: this option is not supported on `RSpec.configuration`, as it needs to
|
|
12
|
+
be set before spec files are loaded.
|
|
13
|
+
|
|
14
|
+
Scenario: run `rspec` with default default_path (`spec` directory)
|
|
15
|
+
Given a file named "spec/example_spec.rb" with:
|
|
16
|
+
"""
|
|
17
|
+
describe "an example" do
|
|
18
|
+
it "passes" do
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
"""
|
|
22
|
+
When I run `rspec`
|
|
23
|
+
Then the output should contain "1 example, 0 failures"
|
|
24
|
+
|
|
25
|
+
Scenario: run `rspec` with customized default_path
|
|
26
|
+
Given a file named ".rspec" with:
|
|
27
|
+
"""
|
|
28
|
+
--default_path behavior
|
|
29
|
+
"""
|
|
30
|
+
Given a file named "behavior/example_spec.rb" with:
|
|
31
|
+
"""
|
|
32
|
+
describe "an example" do
|
|
33
|
+
it "passes" do
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
"""
|
|
37
|
+
When I run `rspec`
|
|
38
|
+
Then the output should contain "1 example, 0 failures"
|
|
@@ -8,47 +8,70 @@ Feature: shared examples
|
|
|
8
8
|
A shared group is included in another group using any of:
|
|
9
9
|
|
|
10
10
|
include_examples "name" # include the examples in the current context
|
|
11
|
-
|
|
12
11
|
it_behaves_like "name" # include the examples in a nested context
|
|
13
12
|
it_should_behave_like "name" # include the examples in a nested context
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
WARNING: Files containing shared groups must be loaded before the files that
|
|
15
|
+
use them. While there are conventions to handle this, RSpec does _not_ do
|
|
16
|
+
anything special (like autoload). Doing so would require a strict naming
|
|
17
|
+
convention for files that would break existing suites.
|
|
18
|
+
|
|
19
|
+
CONVENTIONS:
|
|
20
|
+
|
|
21
|
+
1. The simplest approach is to require files with shared examples explicitly
|
|
22
|
+
from the files that use them. Keep in mind that RSpec adds the `spec`
|
|
23
|
+
directory to the `LOAD_PATH`, so you can say `require
|
|
24
|
+
'shared_examples_for_widgets'` to require a file at
|
|
25
|
+
`#{PROJECT_ROOT}/spec/shared_examples_for_widgets.rb`.
|
|
26
|
+
|
|
27
|
+
2. Put files containing shared examples in `spec/support/` and require files
|
|
28
|
+
in that directory from `spec/spec_helper.rb`:
|
|
29
|
+
|
|
30
|
+
Dir["spec/support/**/*.rb"].each {|f| require f}
|
|
31
|
+
|
|
32
|
+
This is included in the generated `spec/spec_helper.rb` file in
|
|
33
|
+
`rspec-rails`
|
|
34
|
+
|
|
35
|
+
3. When all of the groups that include the shared group, just declare
|
|
36
|
+
the shared group in the same file.
|
|
37
|
+
|
|
38
|
+
Scenario: shared examples group included in two groups in one file
|
|
16
39
|
Given a file named "collection_spec.rb" with:
|
|
17
|
-
|
|
18
|
-
|
|
40
|
+
"""
|
|
41
|
+
require "set"
|
|
19
42
|
|
|
20
|
-
|
|
21
|
-
|
|
43
|
+
shared_examples "a collection" do
|
|
44
|
+
let(:collection) { described_class.new([7, 2, 4]) }
|
|
22
45
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
46
|
+
context "initialized with 3 items" do
|
|
47
|
+
it "says it has three items" do
|
|
48
|
+
collection.size.should eq(3)
|
|
49
|
+
end
|
|
26
50
|
end
|
|
27
|
-
end
|
|
28
51
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
52
|
+
describe "#include?" do
|
|
53
|
+
context "with an an item that is in the collection" do
|
|
54
|
+
it "returns true" do
|
|
55
|
+
collection.include?(7).should be_true
|
|
56
|
+
end
|
|
33
57
|
end
|
|
34
|
-
end
|
|
35
58
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
59
|
+
context "with an an item that is not in the collection" do
|
|
60
|
+
it "returns false" do
|
|
61
|
+
collection.include?(9).should be_false
|
|
62
|
+
end
|
|
39
63
|
end
|
|
40
64
|
end
|
|
41
65
|
end
|
|
42
|
-
end
|
|
43
66
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
67
|
+
describe Array do
|
|
68
|
+
it_behaves_like "a collection"
|
|
69
|
+
end
|
|
47
70
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
71
|
+
describe Set do
|
|
72
|
+
it_behaves_like "a collection"
|
|
73
|
+
end
|
|
74
|
+
"""
|
|
52
75
|
When I run `rspec collection_spec.rb --format documentation`
|
|
53
76
|
Then the examples should all pass
|
|
54
77
|
And the output should contain:
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
Feature: inclusion filters
|
|
2
2
|
|
|
3
|
-
You can
|
|
3
|
+
You can constrain which examples are run by declaring an inclusion filter. The
|
|
4
4
|
most common use case is to focus on a subset of examples as you're focused on
|
|
5
5
|
a particular problem.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
You can specify metadata using only symbols if you set the
|
|
8
|
+
`treat_symbols_as_metadata_keys_with_true_values` config option to `true`.
|
|
9
9
|
|
|
10
10
|
Background:
|
|
11
11
|
Given a file named "spec/spec_helper.rb" with:
|
|
12
12
|
"""
|
|
13
13
|
RSpec.configure do |c|
|
|
14
|
-
|
|
15
|
-
c.filter_run :focus => true
|
|
14
|
+
c.filter_run_including :focus => true
|
|
16
15
|
end
|
|
17
16
|
"""
|
|
18
17
|
|
|
@@ -9,35 +9,38 @@ Feature: text formatter
|
|
|
9
9
|
"""
|
|
10
10
|
describe String do
|
|
11
11
|
it "has a failing example" do
|
|
12
|
-
"foo".reverse.should
|
|
12
|
+
"foo".reverse.should eq("ofo")
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
"""
|
|
16
16
|
And a file named "integer_spec.rb" with:
|
|
17
17
|
"""
|
|
18
|
-
require 'rspec/autorun'
|
|
19
|
-
|
|
20
18
|
describe Integer do
|
|
21
19
|
it "has a failing example" do
|
|
22
|
-
(7 + 5).should
|
|
20
|
+
(7 + 5).should eq(11)
|
|
23
21
|
end
|
|
24
22
|
end
|
|
25
23
|
"""
|
|
26
|
-
When I run `
|
|
24
|
+
When I run `rspec integer_spec.rb string_spec.rb`
|
|
27
25
|
Then the backtrace-normalized output should contain:
|
|
28
26
|
"""
|
|
29
27
|
Failures:
|
|
30
|
-
|
|
28
|
+
|
|
31
29
|
1) Integer has a failing example
|
|
32
|
-
Failure/Error: (7 + 5).should
|
|
30
|
+
Failure/Error: (7 + 5).should eq(11)
|
|
31
|
+
|
|
33
32
|
expected: 11
|
|
34
|
-
got: 12
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
got: 12
|
|
34
|
+
|
|
35
|
+
(compared using ==)
|
|
36
|
+
# ./integer_spec.rb:3
|
|
37
|
+
|
|
37
38
|
2) String has a failing example
|
|
38
|
-
Failure/Error: "foo".reverse.should
|
|
39
|
+
Failure/Error: "foo".reverse.should eq("ofo")
|
|
40
|
+
|
|
39
41
|
expected: "ofo"
|
|
40
|
-
got: "oof"
|
|
42
|
+
got: "oof"
|
|
43
|
+
|
|
44
|
+
(compared using ==)
|
|
41
45
|
# ./string_spec.rb:3
|
|
42
46
|
"""
|
|
43
|
-
|