rspec-core 2.6.2.rc → 2.6.3.beta1
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 +1 -2
- data/features/Changelog.md +10 -1
- data/gem-info.txt +12 -0
- data/lib/rspec/core/formatters/base_formatter.rb +8 -4
- data/lib/rspec/core/formatters/base_text_formatter.rb +12 -0
- data/lib/rspec/core/option_parser.rb +1 -2
- data/lib/rspec/core/runner.rb +1 -1
- data/lib/rspec/core/version.rb +1 -1
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +126 -123
- metadata +8 -6
data/Gemfile
CHANGED
data/features/Changelog.md
CHANGED
@@ -1,4 +1,13 @@
|
|
1
|
-
###
|
1
|
+
### dev
|
2
|
+
|
3
|
+
[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.2...master)
|
4
|
+
|
5
|
+
* Bug fixes
|
6
|
+
* Explicitly convert exit code to integer, avoiding TypeError when return
|
7
|
+
value of run is IO object proxied by DRb::DRbObject (Julian Scheid)
|
8
|
+
|
9
|
+
|
10
|
+
### 2.6.2 / 2011-05-21
|
2
11
|
|
3
12
|
[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.1...v2.6.2)
|
4
13
|
|
data/gem-info.txt
ADDED
@@ -12,6 +12,13 @@ module RSpec
|
|
12
12
|
attr_reader :example_count, :pending_count, :failure_count
|
13
13
|
attr_reader :failed_examples, :pending_examples
|
14
14
|
|
15
|
+
def self.relative_path(line)
|
16
|
+
line = line.sub(File.expand_path("."), ".")
|
17
|
+
line = line.sub(/\A([^:]+:\d+)$/, '\\1')
|
18
|
+
return nil if line == '-e:1'
|
19
|
+
line
|
20
|
+
end
|
21
|
+
|
15
22
|
def initialize(output)
|
16
23
|
@output = output || StringIO.new
|
17
24
|
@example_count = @pending_count = @failure_count = 0
|
@@ -113,10 +120,7 @@ module RSpec
|
|
113
120
|
|
114
121
|
def backtrace_line(line)
|
115
122
|
return nil if configuration.cleaned_from_backtrace?(line)
|
116
|
-
|
117
|
-
line = line.sub(/\A([^:]+:\d+)$/, '\\1')
|
118
|
-
return nil if line == '-e:1'
|
119
|
-
line
|
123
|
+
self.class.relative_path(line)
|
120
124
|
end
|
121
125
|
|
122
126
|
def read_failed_line(exception, example)
|
@@ -39,6 +39,18 @@ module RSpec
|
|
39
39
|
dump_profile if profile_examples? && failure_count == 0
|
40
40
|
output.puts "\nFinished in #{format_seconds(duration)} seconds\n"
|
41
41
|
output.puts colorise_summary(summary_line(example_count, failure_count, pending_count))
|
42
|
+
dump_commands_to_rerun_failed_examples
|
43
|
+
end
|
44
|
+
|
45
|
+
def dump_commands_to_rerun_failed_examples
|
46
|
+
return if failed_examples.empty?
|
47
|
+
output.puts
|
48
|
+
output.puts("Failed examples:")
|
49
|
+
output.puts
|
50
|
+
|
51
|
+
failed_examples.each do |example|
|
52
|
+
output.puts(red("rspec #{BaseFormatter::relative_path(example.location)}") + " " + grey("# #{example.full_description}"))
|
53
|
+
end
|
42
54
|
end
|
43
55
|
|
44
56
|
def dump_profile
|
@@ -40,8 +40,7 @@ module RSpec::Core
|
|
40
40
|
options[:debug] = true
|
41
41
|
end
|
42
42
|
|
43
|
-
parser.on('-e', '--example
|
44
|
-
"(PATTERN is compiled into a Ruby regular expression)") do |o|
|
43
|
+
parser.on('-e', '--example STRING', "Run examples whose full nested names include STRING") do |o|
|
45
44
|
options[:full_description] = Regexp.compile(Regexp.escape(o))
|
46
45
|
end
|
47
46
|
|
data/lib/rspec/core/runner.rb
CHANGED
@@ -8,7 +8,7 @@ module RSpec
|
|
8
8
|
def self.autorun
|
9
9
|
return if autorun_disabled? || installed_at_exit? || running_in_drb?
|
10
10
|
@installed_at_exit = true
|
11
|
-
at_exit { exit(run(ARGV, $stderr, $stdout)) }
|
11
|
+
at_exit { exit(run(ARGV, $stderr, $stdout).to_i) }
|
12
12
|
end
|
13
13
|
AT_EXIT_HOOK_BACKTRACE_LINE = "#{__FILE__}:#{__LINE__ - 2}:in `autorun'"
|
14
14
|
|
data/lib/rspec/core/version.rb
CHANGED
@@ -1,89 +1,112 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'rspec/core/formatters/base_text_formatter'
|
3
3
|
|
4
|
-
|
4
|
+
describe RSpec::Core::Formatters::BaseTextFormatter do
|
5
|
+
let(:output) { StringIO.new }
|
6
|
+
let(:formatter) { RSpec::Core::Formatters::BaseTextFormatter.new(output) }
|
5
7
|
|
6
|
-
describe
|
7
|
-
|
8
|
-
|
8
|
+
describe "#summary_line" do
|
9
|
+
it "with 0s outputs pluralized (excluding pending)" do
|
10
|
+
formatter.summary_line(0,0,0).should eq("0 examples, 0 failures")
|
11
|
+
end
|
9
12
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
formatter.summary_line(0,0,0).should eq("0 examples, 0 failures")
|
14
|
-
end
|
15
|
-
end
|
13
|
+
it "with 1s outputs singular (including pending)" do
|
14
|
+
formatter.summary_line(1,1,1).should eq("1 example, 1 failure, 1 pending")
|
15
|
+
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
17
|
+
it "with 2s outputs pluralized (including pending)" do
|
18
|
+
formatter.summary_line(2,2,2).should eq("2 examples, 2 failures, 2 pending")
|
19
|
+
end
|
20
|
+
end
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
describe "#dump_commands_to_rerun_failed_examples" do
|
23
|
+
it "includes command to re-run each failed example" do
|
24
|
+
group = RSpec::Core::ExampleGroup.describe("example group") do
|
25
|
+
it("fails") { fail }
|
27
26
|
end
|
27
|
+
line = __LINE__ - 2
|
28
|
+
group.run(formatter)
|
29
|
+
formatter.dump_commands_to_rerun_failed_examples
|
30
|
+
output.string.should include("rspec #{RSpec::Core::Formatters::BaseFormatter::relative_path("#{__FILE__}:#{line}")} # example group fails")
|
28
31
|
end
|
32
|
+
end
|
29
33
|
|
30
|
-
|
31
|
-
|
34
|
+
describe "#dump_failures" do
|
35
|
+
let(:group) { RSpec::Core::ExampleGroup.describe("group name") }
|
32
36
|
|
33
|
-
|
37
|
+
before { RSpec.configuration.stub(:color_enabled?) { false } }
|
34
38
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
+
def run_all_and_dump_failures
|
40
|
+
group.run(formatter)
|
41
|
+
formatter.dump_failures
|
42
|
+
end
|
39
43
|
|
40
|
-
|
41
|
-
|
44
|
+
it "preserves formatting" do
|
45
|
+
group.example("example name") { "this".should eq("that") }
|
42
46
|
|
43
|
-
|
47
|
+
run_all_and_dump_failures
|
48
|
+
|
49
|
+
output.string.should =~ /group name example name/m
|
50
|
+
output.string.should =~ /(\s+)expected \"that\"\n\1 got \"this\"/m
|
51
|
+
end
|
44
52
|
|
45
|
-
|
46
|
-
|
53
|
+
context "with an exception without a message" do
|
54
|
+
it "does not throw NoMethodError" do
|
55
|
+
exception_without_message = Exception.new()
|
56
|
+
exception_without_message.stub(:message) { nil }
|
57
|
+
group.example("example name") { raise exception_without_message }
|
58
|
+
expect { run_all_and_dump_failures }.not_to raise_error(NoMethodError)
|
47
59
|
end
|
60
|
+
end
|
48
61
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
expect { run_all_and_dump_failures }.not_to raise_error(NoMethodError)
|
55
|
-
end
|
62
|
+
context "with an exception class other than RSpec" do
|
63
|
+
it "does not show the error class" do
|
64
|
+
group.example("example name") { raise NameError.new('foo') }
|
65
|
+
run_all_and_dump_failures
|
66
|
+
output.string.should =~ /NameError/m
|
56
67
|
end
|
68
|
+
end
|
57
69
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
end
|
70
|
+
context "with a failed expectation (rspec-expectations)" do
|
71
|
+
it "does not show the error class" do
|
72
|
+
group.example("example name") { "this".should eq("that") }
|
73
|
+
run_all_and_dump_failures
|
74
|
+
output.string.should_not =~ /RSpec/m
|
64
75
|
end
|
76
|
+
end
|
65
77
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
78
|
+
context "with a failed message expectation (rspec-mocks)" do
|
79
|
+
it "does not show the error class" do
|
80
|
+
group.example("example name") { "this".should_receive("that") }
|
81
|
+
run_all_and_dump_failures
|
82
|
+
output.string.should_not =~ /RSpec/m
|
72
83
|
end
|
84
|
+
end
|
73
85
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
86
|
+
context 'for #share_examples_for' do
|
87
|
+
it 'outputs the name and location' do
|
88
|
+
|
89
|
+
share_examples_for 'foo bar' do
|
90
|
+
it("example name") { "this".should eq("that") }
|
79
91
|
end
|
92
|
+
|
93
|
+
line = __LINE__.next
|
94
|
+
group.it_should_behave_like('foo bar')
|
95
|
+
|
96
|
+
run_all_and_dump_failures
|
97
|
+
|
98
|
+
output.string.should include(
|
99
|
+
'Shared Example Group: "foo bar" called from ' +
|
100
|
+
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
101
|
+
)
|
80
102
|
end
|
81
103
|
|
82
|
-
context '
|
104
|
+
context 'that contains nested example groups' do
|
83
105
|
it 'outputs the name and location' do
|
84
|
-
|
85
106
|
share_examples_for 'foo bar' do
|
86
|
-
|
107
|
+
describe 'nested group' do
|
108
|
+
it("example name") { "this".should eq("that") }
|
109
|
+
end
|
87
110
|
end
|
88
111
|
|
89
112
|
line = __LINE__.next
|
@@ -96,98 +119,78 @@ module RSpec::Core::Formatters
|
|
96
119
|
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
97
120
|
)
|
98
121
|
end
|
122
|
+
end
|
123
|
+
end
|
99
124
|
|
100
|
-
|
101
|
-
|
102
|
-
share_examples_for 'foo bar' do
|
103
|
-
describe 'nested group' do
|
104
|
-
it("example name") { "this".should eq("that") }
|
105
|
-
end
|
106
|
-
end
|
125
|
+
context 'for #share_as' do
|
126
|
+
it 'outputs the name and location' do
|
107
127
|
|
108
|
-
|
109
|
-
|
128
|
+
share_as :FooBar do
|
129
|
+
it("example name") { "this".should eq("that") }
|
130
|
+
end
|
110
131
|
|
111
|
-
|
132
|
+
line = __LINE__.next
|
133
|
+
group.send(:include, FooBar)
|
112
134
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
135
|
+
run_all_and_dump_failures
|
136
|
+
|
137
|
+
output.string.should include(
|
138
|
+
'Shared Example Group: "FooBar" called from ' +
|
139
|
+
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
140
|
+
)
|
119
141
|
end
|
120
142
|
|
121
|
-
context '
|
143
|
+
context 'that contains nested example groups' do
|
122
144
|
it 'outputs the name and location' do
|
123
145
|
|
124
|
-
share_as :
|
125
|
-
|
146
|
+
share_as :NestedFoo do
|
147
|
+
describe 'nested group' do
|
148
|
+
describe 'hell' do
|
149
|
+
it("example name") { "this".should eq("that") }
|
150
|
+
end
|
151
|
+
end
|
126
152
|
end
|
127
153
|
|
128
154
|
line = __LINE__.next
|
129
|
-
group.send(:include,
|
155
|
+
group.send(:include, NestedFoo)
|
130
156
|
|
131
157
|
run_all_and_dump_failures
|
132
158
|
|
133
159
|
output.string.should include(
|
134
|
-
'Shared Example Group: "
|
160
|
+
'Shared Example Group: "NestedFoo" called from ' +
|
135
161
|
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
136
162
|
)
|
137
163
|
end
|
138
|
-
|
139
|
-
context 'that contains nested example groups' do
|
140
|
-
it 'outputs the name and location' do
|
141
|
-
|
142
|
-
share_as :NestedFoo do
|
143
|
-
describe 'nested group' do
|
144
|
-
describe 'hell' do
|
145
|
-
it("example name") { "this".should eq("that") }
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
line = __LINE__.next
|
151
|
-
group.send(:include, NestedFoo)
|
152
|
-
|
153
|
-
run_all_and_dump_failures
|
154
|
-
|
155
|
-
output.string.should include(
|
156
|
-
'Shared Example Group: "NestedFoo" called from ' +
|
157
|
-
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
158
|
-
)
|
159
|
-
end
|
160
|
-
end
|
161
164
|
end
|
162
165
|
end
|
166
|
+
end
|
163
167
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
end
|
170
|
-
group.run(double('reporter').as_null_object)
|
171
|
-
group.examples
|
168
|
+
describe "#dump_profile" do
|
169
|
+
before do
|
170
|
+
formatter.stub(:examples) do
|
171
|
+
group = RSpec::Core::ExampleGroup.describe("group") do
|
172
|
+
example("example")
|
172
173
|
end
|
174
|
+
group.run(double('reporter').as_null_object)
|
175
|
+
group.examples
|
173
176
|
end
|
177
|
+
end
|
174
178
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
+
it "names the example" do
|
180
|
+
formatter.dump_profile
|
181
|
+
output.string.should =~ /group example/m
|
182
|
+
end
|
179
183
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
+
it "prints the time" do
|
185
|
+
formatter.dump_profile
|
186
|
+
output.string.should =~ /0(\.\d+)? seconds/
|
187
|
+
end
|
184
188
|
|
185
|
-
|
186
|
-
|
187
|
-
|
189
|
+
it "prints the path" do
|
190
|
+
formatter.dump_profile
|
191
|
+
filename = __FILE__.split(File::SEPARATOR).last
|
188
192
|
|
189
|
-
|
190
|
-
end
|
193
|
+
output.string.should =~ /#{filename}\:#{__LINE__ - 21}/
|
191
194
|
end
|
192
195
|
end
|
193
196
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 62196377
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
-
|
11
|
-
|
9
|
+
- 3
|
10
|
+
- beta
|
11
|
+
- 1
|
12
|
+
version: 2.6.3.beta1
|
12
13
|
platform: ruby
|
13
14
|
authors:
|
14
15
|
- Chad Humphries
|
@@ -17,7 +18,7 @@ autorequire:
|
|
17
18
|
bindir: bin
|
18
19
|
cert_chain: []
|
19
20
|
|
20
|
-
date: 2011-05-
|
21
|
+
date: 2011-05-22 00:00:00 -04:00
|
21
22
|
default_executable:
|
22
23
|
dependencies: []
|
23
24
|
|
@@ -93,6 +94,7 @@ files:
|
|
93
94
|
- features/subject/implicit_receiver.feature
|
94
95
|
- features/subject/implicit_subject.feature
|
95
96
|
- features/support/env.rb
|
97
|
+
- gem-info.txt
|
96
98
|
- lib/autotest/discover.rb
|
97
99
|
- lib/autotest/rspec2.rb
|
98
100
|
- lib/rspec/autorun.rb
|
@@ -244,7 +246,7 @@ rubyforge_project: rspec
|
|
244
246
|
rubygems_version: 1.6.2
|
245
247
|
signing_key:
|
246
248
|
specification_version: 3
|
247
|
-
summary: rspec-core-2.6.
|
249
|
+
summary: rspec-core-2.6.3.beta1
|
248
250
|
test_files:
|
249
251
|
- features/Autotest.md
|
250
252
|
- features/Changelog.md
|