rspec-core 2.6.3.beta1 → 2.6.3
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 -1
- data/Rakefile +1 -14
- data/features/Changelog.md +5 -4
- data/lib/rspec/core/formatters/base_formatter.rb +4 -8
- data/lib/rspec/core/formatters/base_text_formatter.rb +0 -12
- data/lib/rspec/core/version.rb +1 -1
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +123 -126
- metadata +9 -14
- data/gem-info.txt +0 -12
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -23,21 +23,9 @@ require "rake/rdoctask"
|
|
23
23
|
require "rspec/core/rake_task"
|
24
24
|
require "rspec/core/version"
|
25
25
|
|
26
|
-
cucumber_loaded = false
|
27
|
-
|
28
26
|
begin
|
29
27
|
require "cucumber/rake/task"
|
30
|
-
|
31
28
|
Cucumber::Rake::Task.new(:cucumber)
|
32
|
-
|
33
|
-
class Cucumber::Rake::Task::ForkedCucumberRunner
|
34
|
-
# When cucumber shells out, we still need it to run in the context of our
|
35
|
-
# bundle.
|
36
|
-
def run
|
37
|
-
sh "bundle exec #{RUBY} " + args.join(" ")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
cucumber_loaded = true
|
41
29
|
rescue LoadError => e
|
42
30
|
puts "unable to load cucumber, some tasks unavailable"
|
43
31
|
task :cucumber do
|
@@ -52,7 +40,6 @@ RSpec::Core::RakeTask.new(:spec) do |t|
|
|
52
40
|
t.verbose = false
|
53
41
|
end
|
54
42
|
|
55
|
-
|
56
43
|
namespace :rcov do
|
57
44
|
task :cleanup do
|
58
45
|
rm_rf 'coverage.data'
|
@@ -64,7 +51,7 @@ namespace :rcov do
|
|
64
51
|
t.rcov_opts << %[--no-html --aggregate coverage.data]
|
65
52
|
end
|
66
53
|
|
67
|
-
if
|
54
|
+
if defined?(Cucumber)
|
68
55
|
Cucumber::Rake::Task.new :cucumber do |t|
|
69
56
|
t.cucumber_opts = %w{--format progress}
|
70
57
|
t.rcov = true
|
data/features/Changelog.md
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
###
|
1
|
+
### 2.6.3 / 2011-05-24
|
2
2
|
|
3
|
-
[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.2...
|
3
|
+
[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.2...v2.6.3)
|
4
4
|
|
5
5
|
* Bug fixes
|
6
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
|
-
|
7
|
+
value of run is IO object proxied by `DRb::DRbObject` (Julian Scheid)
|
8
|
+
* Clarify behavior of `--example` command line option
|
9
|
+
* Build using a rubygems-1.6.2 to avoid downstream yaml parsing error
|
9
10
|
|
10
11
|
### 2.6.2 / 2011-05-21
|
11
12
|
|
@@ -12,13 +12,6 @@ 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
|
-
|
22
15
|
def initialize(output)
|
23
16
|
@output = output || StringIO.new
|
24
17
|
@example_count = @pending_count = @failure_count = 0
|
@@ -120,7 +113,10 @@ module RSpec
|
|
120
113
|
|
121
114
|
def backtrace_line(line)
|
122
115
|
return nil if configuration.cleaned_from_backtrace?(line)
|
123
|
-
|
116
|
+
line = line.sub(File.expand_path("."), ".")
|
117
|
+
line = line.sub(/\A([^:]+:\d+)$/, '\\1')
|
118
|
+
return nil if line == '-e:1'
|
119
|
+
line
|
124
120
|
end
|
125
121
|
|
126
122
|
def read_failed_line(exception, example)
|
@@ -39,18 +39,6 @@ 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
|
54
42
|
end
|
55
43
|
|
56
44
|
def dump_profile
|
data/lib/rspec/core/version.rb
CHANGED
@@ -1,112 +1,89 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'rspec/core/formatters/base_text_formatter'
|
3
3
|
|
4
|
-
|
5
|
-
let(:output) { StringIO.new }
|
6
|
-
let(:formatter) { RSpec::Core::Formatters::BaseTextFormatter.new(output) }
|
4
|
+
module RSpec::Core::Formatters
|
7
5
|
|
8
|
-
describe
|
9
|
-
|
10
|
-
|
11
|
-
end
|
6
|
+
describe BaseTextFormatter do
|
7
|
+
let(:output) { StringIO.new }
|
8
|
+
let(:formatter) { RSpec::Core::Formatters::BaseTextFormatter.new(output) }
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
describe "#summary_line" do
|
11
|
+
context "with 0s" do
|
12
|
+
it "outputs pluralized (excluding pending)" do
|
13
|
+
formatter.summary_line(0,0,0).should eq("0 examples, 0 failures")
|
14
|
+
end
|
15
|
+
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
context "with 1s" do
|
18
|
+
it "outputs singular (including pending)" do
|
19
|
+
formatter.summary_line(1,1,1).should eq("1 example, 1 failure, 1 pending")
|
20
|
+
end
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
context "with 2s" do
|
24
|
+
it "outputs pluralized (including pending)" do
|
25
|
+
formatter.summary_line(2,2,2).should eq("2 examples, 2 failures, 2 pending")
|
26
|
+
end
|
26
27
|
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")
|
31
28
|
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "#dump_failures" do
|
35
|
-
let(:group) { RSpec::Core::ExampleGroup.describe("group name") }
|
36
29
|
|
37
|
-
|
30
|
+
describe "#dump_failures" do
|
31
|
+
let(:group) { RSpec::Core::ExampleGroup.describe("group name") }
|
38
32
|
|
39
|
-
|
40
|
-
group.run(formatter)
|
41
|
-
formatter.dump_failures
|
42
|
-
end
|
33
|
+
before { RSpec.configuration.stub(:color_enabled?) { false } }
|
43
34
|
|
44
|
-
|
45
|
-
|
35
|
+
def run_all_and_dump_failures
|
36
|
+
group.run(formatter)
|
37
|
+
formatter.dump_failures
|
38
|
+
end
|
46
39
|
|
47
|
-
|
40
|
+
it "preserves formatting" do
|
41
|
+
group.example("example name") { "this".should eq("that") }
|
48
42
|
|
49
|
-
|
50
|
-
output.string.should =~ /(\s+)expected \"that\"\n\1 got \"this\"/m
|
51
|
-
end
|
43
|
+
run_all_and_dump_failures
|
52
44
|
|
53
|
-
|
54
|
-
|
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)
|
45
|
+
output.string.should =~ /group name example name/m
|
46
|
+
output.string.should =~ /(\s+)expected \"that\"\n\1 got \"this\"/m
|
59
47
|
end
|
60
|
-
end
|
61
48
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
49
|
+
context "with an exception without a message" do
|
50
|
+
it "does not throw NoMethodError" do
|
51
|
+
exception_without_message = Exception.new()
|
52
|
+
exception_without_message.stub(:message) { nil }
|
53
|
+
group.example("example name") { raise exception_without_message }
|
54
|
+
expect { run_all_and_dump_failures }.not_to raise_error(NoMethodError)
|
55
|
+
end
|
67
56
|
end
|
68
|
-
end
|
69
57
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
58
|
+
context "with an exception class other than RSpec" do
|
59
|
+
it "does not show the error class" do
|
60
|
+
group.example("example name") { raise NameError.new('foo') }
|
61
|
+
run_all_and_dump_failures
|
62
|
+
output.string.should =~ /NameError/m
|
63
|
+
end
|
75
64
|
end
|
76
|
-
end
|
77
65
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
66
|
+
context "with a failed expectation (rspec-expectations)" do
|
67
|
+
it "does not show the error class" do
|
68
|
+
group.example("example name") { "this".should eq("that") }
|
69
|
+
run_all_and_dump_failures
|
70
|
+
output.string.should_not =~ /RSpec/m
|
71
|
+
end
|
83
72
|
end
|
84
|
-
end
|
85
|
-
|
86
|
-
context 'for #share_examples_for' do
|
87
|
-
it 'outputs the name and location' do
|
88
73
|
|
89
|
-
|
90
|
-
|
74
|
+
context "with a failed message expectation (rspec-mocks)" do
|
75
|
+
it "does not show the error class" do
|
76
|
+
group.example("example name") { "this".should_receive("that") }
|
77
|
+
run_all_and_dump_failures
|
78
|
+
output.string.should_not =~ /RSpec/m
|
91
79
|
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
|
-
)
|
102
80
|
end
|
103
81
|
|
104
|
-
context '
|
82
|
+
context 'for #share_examples_for' do
|
105
83
|
it 'outputs the name and location' do
|
84
|
+
|
106
85
|
share_examples_for 'foo bar' do
|
107
|
-
|
108
|
-
it("example name") { "this".should eq("that") }
|
109
|
-
end
|
86
|
+
it("example name") { "this".should eq("that") }
|
110
87
|
end
|
111
88
|
|
112
89
|
line = __LINE__.next
|
@@ -119,78 +96,98 @@ describe RSpec::Core::Formatters::BaseTextFormatter do
|
|
119
96
|
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
120
97
|
)
|
121
98
|
end
|
122
|
-
end
|
123
|
-
end
|
124
99
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
100
|
+
context 'that contains nested example groups' do
|
101
|
+
it 'outputs the name and location' do
|
102
|
+
share_examples_for 'foo bar' do
|
103
|
+
describe 'nested group' do
|
104
|
+
it("example name") { "this".should eq("that") }
|
105
|
+
end
|
106
|
+
end
|
131
107
|
|
132
|
-
|
133
|
-
|
108
|
+
line = __LINE__.next
|
109
|
+
group.it_should_behave_like('foo bar')
|
134
110
|
|
135
|
-
|
111
|
+
run_all_and_dump_failures
|
136
112
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
113
|
+
output.string.should include(
|
114
|
+
'Shared Example Group: "foo bar" called from ' +
|
115
|
+
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
116
|
+
)
|
117
|
+
end
|
118
|
+
end
|
141
119
|
end
|
142
120
|
|
143
|
-
context '
|
121
|
+
context 'for #share_as' do
|
144
122
|
it 'outputs the name and location' do
|
145
123
|
|
146
|
-
share_as :
|
147
|
-
|
148
|
-
describe 'hell' do
|
149
|
-
it("example name") { "this".should eq("that") }
|
150
|
-
end
|
151
|
-
end
|
124
|
+
share_as :FooBar do
|
125
|
+
it("example name") { "this".should eq("that") }
|
152
126
|
end
|
153
127
|
|
154
128
|
line = __LINE__.next
|
155
|
-
group.send(:include,
|
129
|
+
group.send(:include, FooBar)
|
156
130
|
|
157
131
|
run_all_and_dump_failures
|
158
132
|
|
159
133
|
output.string.should include(
|
160
|
-
'Shared Example Group: "
|
134
|
+
'Shared Example Group: "FooBar" called from ' +
|
161
135
|
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
162
136
|
)
|
163
137
|
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
|
164
161
|
end
|
165
162
|
end
|
166
|
-
end
|
167
163
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
164
|
+
describe "#dump_profile" do
|
165
|
+
before do
|
166
|
+
formatter.stub(:examples) do
|
167
|
+
group = RSpec::Core::ExampleGroup.describe("group") do
|
168
|
+
example("example")
|
169
|
+
end
|
170
|
+
group.run(double('reporter').as_null_object)
|
171
|
+
group.examples
|
173
172
|
end
|
174
|
-
group.run(double('reporter').as_null_object)
|
175
|
-
group.examples
|
176
173
|
end
|
177
|
-
end
|
178
174
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
175
|
+
it "names the example" do
|
176
|
+
formatter.dump_profile
|
177
|
+
output.string.should =~ /group example/m
|
178
|
+
end
|
183
179
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
180
|
+
it "prints the time" do
|
181
|
+
formatter.dump_profile
|
182
|
+
output.string.should =~ /0(\.\d+)? seconds/
|
183
|
+
end
|
188
184
|
|
189
|
-
|
190
|
-
|
191
|
-
|
185
|
+
it "prints the path" do
|
186
|
+
formatter.dump_profile
|
187
|
+
filename = __FILE__.split(File::SEPARATOR).last
|
192
188
|
|
193
|
-
|
189
|
+
output.string.should =~ /#{filename}\:#{__LINE__ - 21}/
|
190
|
+
end
|
194
191
|
end
|
195
192
|
end
|
196
193
|
end
|
metadata
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 17
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 6
|
9
9
|
- 3
|
10
|
-
|
11
|
-
- 1
|
12
|
-
version: 2.6.3.beta1
|
10
|
+
version: 2.6.3
|
13
11
|
platform: ruby
|
14
12
|
authors:
|
15
13
|
- Chad Humphries
|
@@ -18,7 +16,7 @@ autorequire:
|
|
18
16
|
bindir: bin
|
19
17
|
cert_chain: []
|
20
18
|
|
21
|
-
date: 2011-05-
|
19
|
+
date: 2011-05-24 00:00:00 -05:00
|
22
20
|
default_executable:
|
23
21
|
dependencies: []
|
24
22
|
|
@@ -94,7 +92,6 @@ files:
|
|
94
92
|
- features/subject/implicit_receiver.feature
|
95
93
|
- features/subject/implicit_subject.feature
|
96
94
|
- features/support/env.rb
|
97
|
-
- gem-info.txt
|
98
95
|
- lib/autotest/discover.rb
|
99
96
|
- lib/autotest/rspec2.rb
|
100
97
|
- lib/rspec/autorun.rb
|
@@ -232,21 +229,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
232
229
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
230
|
none: false
|
234
231
|
requirements:
|
235
|
-
- - "
|
232
|
+
- - ">="
|
236
233
|
- !ruby/object:Gem::Version
|
237
|
-
hash:
|
234
|
+
hash: 3
|
238
235
|
segments:
|
239
|
-
-
|
240
|
-
|
241
|
-
- 1
|
242
|
-
version: 1.3.1
|
236
|
+
- 0
|
237
|
+
version: "0"
|
243
238
|
requirements: []
|
244
239
|
|
245
240
|
rubyforge_project: rspec
|
246
241
|
rubygems_version: 1.6.2
|
247
242
|
signing_key:
|
248
243
|
specification_version: 3
|
249
|
-
summary: rspec-core-2.6.3
|
244
|
+
summary: rspec-core-2.6.3
|
250
245
|
test_files:
|
251
246
|
- features/Autotest.md
|
252
247
|
- features/Changelog.md
|