rspec-core 2.0.0.beta.22 → 2.0.0.rc
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/Gemfile +2 -2
- data/{History.md → History.markdown} +24 -2
- data/Rakefile +1 -0
- data/Upgrade.markdown +36 -3
- data/bin/rspec +1 -2
- data/features/command_line/configure.feature +4 -4
- data/features/command_line/example_name_option.feature +17 -3
- data/features/command_line/exit_status.feature +13 -28
- data/features/command_line/line_number_appended_to_path.feature +12 -16
- data/features/command_line/line_number_option.feature +4 -5
- data/features/command_line/rake_task.feature +68 -0
- data/features/configuration/custom_settings.feature +2 -4
- data/features/configuration/fail_fast.feature +77 -0
- data/features/configuration/read_options_from_file.feature +2 -5
- data/features/example_groups/basic_structure.feature +54 -0
- data/features/example_groups/shared_example_group.feature +38 -27
- data/features/filtering/exclusion_filters.feature +40 -4
- data/features/filtering/inclusion_filters.feature +36 -27
- data/features/filtering/run_all_when_everything_filtered.feature +46 -0
- data/features/hooks/before_and_after_hooks.feature +21 -1
- data/features/pending/pending_examples.feature +24 -5
- data/lib/rspec/autorun.rb +2 -0
- data/lib/rspec/core.rb +6 -4
- data/lib/rspec/core/configuration.rb +69 -23
- data/lib/rspec/core/configuration_options.rb +1 -0
- data/lib/rspec/core/example.rb +0 -1
- data/lib/rspec/core/example_group.rb +23 -8
- data/lib/rspec/core/formatters/base_formatter.rb +14 -4
- data/lib/rspec/core/formatters/base_text_formatter.rb +2 -0
- data/lib/rspec/core/formatters/documentation_formatter.rb +2 -0
- data/lib/rspec/core/formatters/progress_formatter.rb +1 -0
- data/lib/rspec/core/metadata.rb +18 -11
- data/lib/rspec/core/option_parser.rb +6 -1
- data/lib/rspec/core/rake_task.rb +10 -10
- data/lib/rspec/core/runner.rb +20 -1
- data/lib/rspec/core/subject.rb +26 -3
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +2 -1
- data/spec/autotest/failed_results_re_spec.rb +1 -1
- data/spec/rspec/core/configuration_spec.rb +13 -0
- data/spec/rspec/core/example_group_spec.rb +107 -26
- data/spec/rspec/core/example_spec.rb +11 -24
- data/spec/rspec/core/formatters/base_formatter_spec.rb +17 -1
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +6 -5
- data/spec/rspec/core/formatters/documentation_formatter_spec.rb +3 -2
- data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +25 -22
- data/spec/rspec/core/formatters/html_formatted-1.8.7.html +23 -20
- data/spec/rspec/core/formatters/html_formatted-1.9.1.html +25 -22
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +25 -2
- data/spec/rspec/core/formatters/html_formatter_spec.rb +10 -2
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +1 -0
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +1 -0
- data/spec/rspec/core/hooks_filtering_spec.rb +5 -5
- data/spec/rspec/core/hooks_spec.rb +4 -4
- data/spec/rspec/core/metadata_spec.rb +20 -0
- data/spec/rspec/core/option_parser_spec.rb +16 -0
- data/spec/rspec/core/rake_task_spec.rb +0 -1
- data/spec/rspec/core/reporter_spec.rb +1 -1
- data/spec/rspec/core/runner_spec.rb +18 -0
- data/spec/rspec/core/shared_example_group_spec.rb +2 -2
- data/spec/spec_helper.rb +14 -3
- metadata +54 -45
- data/.rspec +0 -1
- data/features/example_groups/describe_aliases.feature +0 -25
- data/features/example_groups/nested_groups.feature +0 -44
- data/lib/rspec/core/around_proxy.rb +0 -14
- data/lib/rspec/core/formatters.rb +0 -8
data/Gemfile
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
## rspec-core release history (incomplete)
|
2
2
|
|
3
|
+
### 2.0.0.rc / 2010-10-05
|
4
|
+
|
5
|
+
[full changelog](http://github.com/rspec/rspec-core/compare/v2.0.0.beta.22...v2.0.0.rc)
|
6
|
+
|
7
|
+
* Enhancements
|
8
|
+
* implicitly require unknown formatters so you don't have to require the
|
9
|
+
file explicitly on the commmand line (Michael Grosser)
|
10
|
+
* add --out/-o option to assign output target
|
11
|
+
* added fail_fast configuration option to abort on first failure
|
12
|
+
* support a Hash subject (its([:key]) { should == value }) (Josep M. Bach)
|
13
|
+
|
14
|
+
* Bug fixes
|
15
|
+
* Explicitly require rspec version to fix broken rdoc task (Hans de Graaff)
|
16
|
+
* Ignore backtrace lines that come from other languages, like Java or
|
17
|
+
Javascript (Charles Lowell)
|
18
|
+
* Rake task now does what is expected when setting (or not setting)
|
19
|
+
fail_on_error and verbose
|
20
|
+
* Fix bug in which before/after(:all) hooks were running on excluded nested
|
21
|
+
groups (Myron Marston)
|
22
|
+
* Fix before(:all) error handling so that it fails examples in nested groups,
|
23
|
+
too (Myron Marston)
|
24
|
+
|
3
25
|
### 2.0.0.beta.22 / 2010-09-12
|
4
26
|
|
5
27
|
[full changelog](http://github.com/rspec/rspec-core/compare/v2.0.0.beta.20...v2.0.0.beta.22)
|
@@ -15,12 +37,12 @@
|
|
15
37
|
* deprecated redundant options
|
16
38
|
* run 'bundle exec autotest' when Gemfile is present
|
17
39
|
* support ERB in .rspec options files (Justin Ko)
|
18
|
-
* depend on bundler for development tasks (Myron
|
40
|
+
* depend on bundler for development tasks (Myron Marston)
|
19
41
|
* add example_group_finished to formatters and reporter (Roman Chernyatchik)
|
20
42
|
|
21
43
|
* Bug fixes
|
22
44
|
* support paths with spaces when using autotest (Andreas Neuhaus)
|
23
|
-
* fix module_exec with ruby 1.8.6 (Myron
|
45
|
+
* fix module_exec with ruby 1.8.6 (Myron Marston)
|
24
46
|
* remove context method from top-level
|
25
47
|
* was conflicting with irb, for example
|
26
48
|
* errors in before(:all) are now reported correctly (Chad Humphries)
|
data/Rakefile
CHANGED
data/Upgrade.markdown
CHANGED
@@ -14,6 +14,15 @@ The RSpec rake task has moved to:
|
|
14
14
|
|
15
15
|
'rspec/core/rake_task'
|
16
16
|
|
17
|
+
RCov options are now set directly on the Rake task:
|
18
|
+
|
19
|
+
RSpec::Core::RakeTask.new(:rcov) do |t|
|
20
|
+
t.rcov_opts = %q[--exclude "spec"]
|
21
|
+
end
|
22
|
+
|
23
|
+
In RSpec-1, the rake task would read in rcov options from an `rcov.opts`
|
24
|
+
file. This is ignored by RSpec-2.
|
25
|
+
|
17
26
|
### autotest
|
18
27
|
|
19
28
|
RSpec-2 works with autotest as follows:
|
@@ -26,17 +35,17 @@ This adds `./autotest/discover.rb` with:
|
|
26
35
|
|
27
36
|
Now, on the command line just type:
|
28
37
|
|
29
|
-
|
38
|
+
autotest
|
30
39
|
|
31
40
|
Or, if you're using bundler:
|
32
41
|
|
33
|
-
|
42
|
+
bundle exec autotest
|
34
43
|
|
35
44
|
The `autospec` command is a thing of the past.
|
36
45
|
|
37
46
|
### RSpec
|
38
47
|
|
39
|
-
The root namespace (top level module
|
48
|
+
The root namespace (top level module) is now `RSpec` instead of `Spec`, and
|
40
49
|
the root directory under `lib` within all of the `rspec` gems is `rspec` instead of `spec`.
|
41
50
|
|
42
51
|
### Configuration
|
@@ -57,6 +66,30 @@ options. Precedence is:
|
|
57
66
|
./.rspec
|
58
67
|
~/.rspec
|
59
68
|
|
69
|
+
### `context` is no longer a top-level method
|
70
|
+
|
71
|
+
We removed `context` from the main object because it was creating conflicts with
|
72
|
+
IRB and some users who had `Context` domain objects. `describe` is still there,
|
73
|
+
so if you want to use `context` at the top level, just alias it:
|
74
|
+
|
75
|
+
alias :context :describe
|
76
|
+
|
77
|
+
Of course, you can still use `context` to declare a nested group:
|
78
|
+
|
79
|
+
describe "something" do
|
80
|
+
context "in some context" do
|
81
|
+
it "does something" do
|
82
|
+
# ...
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
### `$KCODE` no longer set implicitly to `'u'`
|
88
|
+
|
89
|
+
In RSpec-1, the runner set `$KCODE` to `'u'`, which impacts, among other
|
90
|
+
things, the behaviour of Regular Expressions when applied to non-ascii
|
91
|
+
characters. This is no longer the case in RSpec-2.
|
92
|
+
|
60
93
|
## What's new
|
61
94
|
|
62
95
|
### Runner
|
data/bin/rspec
CHANGED
@@ -2,15 +2,15 @@ Feature: configure
|
|
2
2
|
|
3
3
|
Use --configure to generate configuration files.
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
The only supported argument, so far, is "autotest", which creates an
|
6
|
+
autotest/discover.rb file in your project root directory.
|
7
7
|
|
8
8
|
Background:
|
9
9
|
Given a directory named "rspec_project"
|
10
|
-
And I cd to "rspec_project"
|
11
10
|
|
12
11
|
Scenario: generate autotest directory and discover file
|
13
|
-
When I
|
12
|
+
When I cd to "rspec_project"
|
13
|
+
And I run "rspec --configure autotest"
|
14
14
|
Then the following directories should exist:
|
15
15
|
| autotest |
|
16
16
|
And the following files should exist:
|
@@ -17,14 +17,14 @@ Feature: example name option
|
|
17
17
|
it "second example in first group" do; end
|
18
18
|
end
|
19
19
|
"""
|
20
|
-
|
20
|
+
And a file named "second_spec.rb" with:
|
21
21
|
"""
|
22
22
|
describe "second group" do
|
23
23
|
it "first example in second group" do; end
|
24
24
|
it "second example in second group" do; end
|
25
25
|
end
|
26
26
|
"""
|
27
|
-
|
27
|
+
And a file named "third_spec.rb" with:
|
28
28
|
"""
|
29
29
|
describe "third group" do
|
30
30
|
it "first example in third group" do; end
|
@@ -34,6 +34,16 @@ Feature: example name option
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
"""
|
37
|
+
And a file named "fourth_spec.rb" with:
|
38
|
+
"""
|
39
|
+
describe Array do
|
40
|
+
describe "#length" do
|
41
|
+
it "is the number of items" do
|
42
|
+
Array.new([1,2,3]).length.should eq 3
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
"""
|
37
47
|
|
38
48
|
Scenario: no matches
|
39
49
|
When I run "rspec . --example nothing_like_this"
|
@@ -69,4 +79,8 @@ Feature: example name option
|
|
69
79
|
|
70
80
|
Scenario: all examples in one group including examples in nested groups
|
71
81
|
When I run "rspec . --example 'third group'"
|
72
|
-
Then the output should contain "3 examples, 0 failures"
|
82
|
+
Then the output should contain "3 examples, 0 failures"
|
83
|
+
|
84
|
+
Scenario: Object#method
|
85
|
+
When I run "rspec . --example 'Array#length'"
|
86
|
+
Then the output should contain "1 example, 0 failures"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
Feature: exit status
|
2
|
-
|
3
|
-
the spec CLI exits with an
|
2
|
+
|
3
|
+
In order to fail the build when it should, the spec CLI exits with an
|
4
|
+
appropriate exit status
|
4
5
|
|
5
6
|
Scenario: exit with 0 when all examples pass
|
6
7
|
Given a file named "ok_spec.rb" with:
|
@@ -11,10 +12,8 @@ Feature: exit status
|
|
11
12
|
end
|
12
13
|
"""
|
13
14
|
When I run "rspec ok_spec.rb"
|
14
|
-
Then
|
15
|
-
|
16
|
-
1 example, 0 failures
|
17
|
-
"""
|
15
|
+
Then the exit status should be 0
|
16
|
+
And the stdout should contain "1 example, 0 failures"
|
18
17
|
|
19
18
|
Scenario: exit with 1 when one example fails
|
20
19
|
Given a file named "ko_spec.rb" with:
|
@@ -26,10 +25,8 @@ Feature: exit status
|
|
26
25
|
end
|
27
26
|
"""
|
28
27
|
When I run "rspec ko_spec.rb"
|
29
|
-
Then
|
30
|
-
|
31
|
-
1 example, 1 failure
|
32
|
-
"""
|
28
|
+
Then the exit status should be 1
|
29
|
+
And the stdout should contain "1 example, 1 failure"
|
33
30
|
|
34
31
|
Scenario: exit with 1 when a nested examples fails
|
35
32
|
Given a file named "nested_ko_spec.rb" with:
|
@@ -43,25 +40,13 @@ Feature: exit status
|
|
43
40
|
end
|
44
41
|
"""
|
45
42
|
When I run "rspec nested_ko_spec.rb"
|
46
|
-
Then
|
47
|
-
|
48
|
-
1 example, 1 failure
|
49
|
-
"""
|
43
|
+
Then the exit status should be 1
|
44
|
+
And the stdout should contain "1 example, 1 failure"
|
50
45
|
|
51
46
|
Scenario: exit with 0 when no examples are run
|
52
|
-
Given a file named "
|
53
|
-
"""
|
54
|
-
"""
|
55
|
-
And a file named "spec/b_one_example_spec.rb" with:
|
56
|
-
"""
|
57
|
-
describe "something" do
|
58
|
-
it "does something" do
|
59
|
-
end
|
60
|
-
end
|
61
|
-
"""
|
62
|
-
|
63
|
-
When I run "rspec spec"
|
64
|
-
Then it should pass with:
|
47
|
+
Given a file named "a_no_examples_spec.rb" with:
|
65
48
|
"""
|
66
|
-
1 example, 0 failures
|
67
49
|
"""
|
50
|
+
When I run "rspec a_no_examples_spec.rb"
|
51
|
+
Then the exit status should be 0
|
52
|
+
And the stdout should contain "0 examples, 0 failures"
|
@@ -1,8 +1,6 @@
|
|
1
1
|
Feature: line number appended to file path
|
2
2
|
|
3
|
-
|
4
|
-
I want to run one example identified by the
|
5
|
-
line number appended to the filepath
|
3
|
+
Append a line number to the path to run a single example, or a single group.
|
6
4
|
|
7
5
|
Background:
|
8
6
|
Given a file named "example_spec.rb" with:
|
@@ -29,80 +27,78 @@ Feature: line number appended to file path
|
|
29
27
|
"""
|
30
28
|
|
31
29
|
Scenario: nested groups - outer group on declaration line
|
32
|
-
When I run "rspec
|
30
|
+
When I run "rspec example_spec.rb:1 --format doc"
|
33
31
|
Then the output should contain "3 examples, 0 failures"
|
34
32
|
And the output should contain "second example in outer group"
|
35
33
|
And the output should contain "first example in outer group"
|
36
34
|
And the output should contain "example in nested group"
|
37
35
|
|
38
36
|
Scenario: nested groups - outer group inside block before example
|
39
|
-
When I run "rspec
|
37
|
+
When I run "rspec example_spec.rb:2 --format doc"
|
40
38
|
Then the output should contain "3 examples, 0 failures"
|
41
39
|
And the output should contain "second example in outer group"
|
42
40
|
And the output should contain "first example in outer group"
|
43
41
|
And the output should contain "example in nested group"
|
44
42
|
|
45
43
|
Scenario: nested groups - inner group on declaration line
|
46
|
-
When I run "rspec
|
44
|
+
When I run "rspec example_spec.rb:11 --format doc"
|
47
45
|
Then the output should contain "1 example, 0 failures"
|
48
46
|
And the output should contain "example in nested group"
|
49
47
|
And the output should not contain "second example in outer group"
|
50
48
|
And the output should not contain "first example in outer group"
|
51
49
|
|
52
50
|
Scenario: nested groups - inner group inside block before example
|
53
|
-
When I run "rspec
|
51
|
+
When I run "rspec example_spec.rb:12 --format doc"
|
54
52
|
Then the output should contain "1 example, 0 failures"
|
55
53
|
And the output should contain "example in nested group"
|
56
54
|
And the output should not contain "second example in outer group"
|
57
55
|
And the output should not contain "first example in outer group"
|
58
56
|
|
59
57
|
Scenario: two examples - first example on declaration line
|
60
|
-
When I run "rspec
|
58
|
+
When I run "rspec example_spec.rb:3 --format doc"
|
61
59
|
Then the output should contain "1 example, 0 failures"
|
62
60
|
And the output should contain "first example in outer group"
|
63
61
|
But the output should not contain "second example in outer group"
|
64
62
|
And the output should not contain "example in nested group"
|
65
63
|
|
66
64
|
Scenario: two examples - first example inside block
|
67
|
-
When I run "rspec
|
65
|
+
When I run "rspec example_spec.rb:4 --format doc"
|
68
66
|
Then the output should contain "1 example, 0 failures"
|
69
67
|
And the output should contain "first example in outer group"
|
70
68
|
But the output should not contain "second example in outer group"
|
71
69
|
And the output should not contain "example in nested group"
|
72
70
|
|
73
71
|
Scenario: two examples - first example on end
|
74
|
-
When I run "rspec
|
72
|
+
When I run "rspec example_spec.rb:5 --format doc"
|
75
73
|
Then the output should contain "1 example, 0 failures"
|
76
74
|
And the output should contain "first example in outer group"
|
77
75
|
But the output should not contain "second example in outer group"
|
78
76
|
And the output should not contain "example in nested group"
|
79
77
|
|
80
78
|
Scenario: two examples - first example after end but before next example
|
81
|
-
When I run "rspec
|
79
|
+
When I run "rspec example_spec.rb:6 --format doc"
|
82
80
|
Then the output should contain "1 example, 0 failures"
|
83
81
|
And the output should contain "first example in outer group"
|
84
82
|
But the output should not contain "second example in outer group"
|
85
83
|
And the output should not contain "example in nested group"
|
86
84
|
|
87
85
|
Scenario: two examples - second example on declaration line
|
88
|
-
When I run "rspec
|
86
|
+
When I run "rspec example_spec.rb:7 --format doc"
|
89
87
|
Then the output should contain "1 example, 0 failures"
|
90
88
|
And the output should contain "second example in outer group"
|
91
89
|
But the output should not contain "first example in outer group"
|
92
90
|
And the output should not contain "example in nested group"
|
93
91
|
|
94
92
|
Scenario: two examples - second example inside block
|
95
|
-
When I run "rspec
|
93
|
+
When I run "rspec example_spec.rb:7 --format doc"
|
96
94
|
Then the output should contain "1 example, 0 failures"
|
97
95
|
And the output should contain "second example in outer group"
|
98
96
|
But the output should not contain "first example in outer group"
|
99
97
|
And the output should not contain "example in nested group"
|
100
98
|
|
101
99
|
Scenario: two examples - second example on end
|
102
|
-
When I run "rspec
|
100
|
+
When I run "rspec example_spec.rb:7 --format doc"
|
103
101
|
Then the output should contain "1 example, 0 failures"
|
104
102
|
And the output should contain "second example in outer group"
|
105
103
|
But the output should not contain "first example in outer group"
|
106
104
|
And the output should not contain "example in nested group"
|
107
|
-
|
108
|
-
|
@@ -1,8 +1,7 @@
|
|
1
1
|
Feature: line number option
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
Use the line number option to run a single example, or a single group.
|
4
|
+
|
6
5
|
Scenario: standard examples
|
7
6
|
Given a file named "example_spec.rb" with:
|
8
7
|
"""
|
@@ -20,7 +19,7 @@ Feature: line number option
|
|
20
19
|
|
21
20
|
end
|
22
21
|
"""
|
23
|
-
When I run "rspec
|
22
|
+
When I run "rspec example_spec.rb --line 5 --format doc"
|
24
23
|
Then the output should contain "1 example, 0 failures"
|
25
24
|
Then the output should contain "should be > 8"
|
26
25
|
But the stdout should not contain "should be < 10"
|
@@ -38,7 +37,7 @@ Feature: line number option
|
|
38
37
|
|
39
38
|
end
|
40
39
|
"""
|
41
|
-
When I run "rspec
|
40
|
+
When I run "rspec example_spec.rb --line 5 --format doc"
|
42
41
|
Then the output should contain "1 example, 0 failures"
|
43
42
|
Then the output should contain "should be > 8"
|
44
43
|
But the stdout should not contain "should be < 10"
|
@@ -0,0 +1,68 @@
|
|
1
|
+
Feature: rake task
|
2
|
+
|
3
|
+
RSpec ships with a rake task with a number of useful options
|
4
|
+
|
5
|
+
Scenario: default options with passing spec (prints command and exit status is 0)
|
6
|
+
Given a file named "Rakefile" with:
|
7
|
+
"""
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
|
10
|
+
RSpec::Core::RakeTask.new(:spec)
|
11
|
+
|
12
|
+
task :default => :spec
|
13
|
+
"""
|
14
|
+
And a file named "spec/thing_spec.rb" with:
|
15
|
+
"""
|
16
|
+
describe "something" do
|
17
|
+
it "does something" do
|
18
|
+
# pass
|
19
|
+
end
|
20
|
+
end
|
21
|
+
"""
|
22
|
+
When I run "rake"
|
23
|
+
Then the stderr should contain "ruby -S rspec"
|
24
|
+
Then the exit status should be 0
|
25
|
+
|
26
|
+
Scenario: default options with failing spec (exit status is 1)
|
27
|
+
Given a file named "Rakefile" with:
|
28
|
+
"""
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
|
31
|
+
RSpec::Core::RakeTask.new(:spec)
|
32
|
+
|
33
|
+
task :default => :spec
|
34
|
+
"""
|
35
|
+
And a file named "spec/thing_spec.rb" with:
|
36
|
+
"""
|
37
|
+
describe "something" do
|
38
|
+
it "does something" do
|
39
|
+
fail
|
40
|
+
end
|
41
|
+
end
|
42
|
+
"""
|
43
|
+
When I run "rake"
|
44
|
+
Then the exit status should be 1
|
45
|
+
|
46
|
+
Scenario: fail_on_error = false with failing spec (exit status is 0)
|
47
|
+
Given a file named "Rakefile" with:
|
48
|
+
"""
|
49
|
+
require 'rspec/core/rake_task'
|
50
|
+
|
51
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
52
|
+
t.fail_on_error = false
|
53
|
+
end
|
54
|
+
|
55
|
+
task :default => :spec
|
56
|
+
"""
|
57
|
+
And a file named "spec/thing_spec.rb" with:
|
58
|
+
"""
|
59
|
+
describe "something" do
|
60
|
+
it "does something" do
|
61
|
+
fail
|
62
|
+
end
|
63
|
+
end
|
64
|
+
"""
|
65
|
+
When I run "rake"
|
66
|
+
Then the exit status should be 0
|
67
|
+
|
68
|
+
|