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 CHANGED
@@ -10,9 +10,8 @@ source "http://rubygems.org"
10
10
  end
11
11
  end
12
12
 
13
-
14
13
  ### dev dependencies
15
- gem "rake", "0.8.7"
14
+ gem "rake", "~> 0.8"
16
15
  gem "cucumber", "~> 0.10.2"
17
16
  gem "aruba", "~> 0.3.6"
18
17
  gem "rcov", "0.9.9", :platforms => :mri
@@ -1,4 +1,13 @@
1
- ### 2.6.2 / 2011-05-20
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
 
@@ -0,0 +1,12 @@
1
+ build | read | status
2
+ 1.3.7 | 1.3.7 | ok
3
+ 1.3.7 | 1.6.2 | ok
4
+ 1.3.7 | 1.7.2 | ok
5
+ 1.3.7 | 1.8.3 | ok
6
+
7
+ 1.8.3 | 1.8.3 | ok
8
+ 1.8.3 | 1.7.2 | ok
9
+ 1.8.3 | 1.6.2 | ok
10
+ 1.8.3 | 1.3.7 | ok
11
+
12
+ 1.7.2
@@ -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
- line = line.sub(File.expand_path("."), ".")
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 PATTERN', "Run examples whose full descriptions match this pattern",
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
 
@@ -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
 
@@ -1,7 +1,7 @@
1
1
  module RSpec # :nodoc:
2
2
  module Core # :nodoc:
3
3
  module Version # :nodoc:
4
- STRING = '2.6.2.rc'
4
+ STRING = '2.6.3.beta1'
5
5
  end
6
6
  end
7
7
  end
@@ -1,89 +1,112 @@
1
1
  require 'spec_helper'
2
2
  require 'rspec/core/formatters/base_text_formatter'
3
3
 
4
- module RSpec::Core::Formatters
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 BaseTextFormatter do
7
- let(:output) { StringIO.new }
8
- let(:formatter) { RSpec::Core::Formatters::BaseTextFormatter.new(output) }
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
- 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
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
- 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
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
- 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
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
- describe "#dump_failures" do
31
- let(:group) { RSpec::Core::ExampleGroup.describe("group name") }
34
+ describe "#dump_failures" do
35
+ let(:group) { RSpec::Core::ExampleGroup.describe("group name") }
32
36
 
33
- before { RSpec.configuration.stub(:color_enabled?) { false } }
37
+ before { RSpec.configuration.stub(:color_enabled?) { false } }
34
38
 
35
- def run_all_and_dump_failures
36
- group.run(formatter)
37
- formatter.dump_failures
38
- end
39
+ def run_all_and_dump_failures
40
+ group.run(formatter)
41
+ formatter.dump_failures
42
+ end
39
43
 
40
- it "preserves formatting" do
41
- group.example("example name") { "this".should eq("that") }
44
+ it "preserves formatting" do
45
+ group.example("example name") { "this".should eq("that") }
42
46
 
43
- run_all_and_dump_failures
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
- output.string.should =~ /group name example name/m
46
- output.string.should =~ /(\s+)expected \"that\"\n\1 got \"this\"/m
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
- 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
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
- 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
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
- 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
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
- 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
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 'for #share_examples_for' do
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
- it("example name") { "this".should eq("that") }
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
- 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
125
+ context 'for #share_as' do
126
+ it 'outputs the name and location' do
107
127
 
108
- line = __LINE__.next
109
- group.it_should_behave_like('foo bar')
128
+ share_as :FooBar do
129
+ it("example name") { "this".should eq("that") }
130
+ end
110
131
 
111
- run_all_and_dump_failures
132
+ line = __LINE__.next
133
+ group.send(:include, FooBar)
112
134
 
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
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 'for #share_as' do
143
+ context 'that contains nested example groups' do
122
144
  it 'outputs the name and location' do
123
145
 
124
- share_as :FooBar do
125
- it("example name") { "this".should eq("that") }
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, FooBar)
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: "FooBar" called from ' +
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
- 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
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
- it "names the example" do
176
- formatter.dump_profile
177
- output.string.should =~ /group example/m
178
- end
179
+ it "names the example" do
180
+ formatter.dump_profile
181
+ output.string.should =~ /group example/m
182
+ end
179
183
 
180
- it "prints the time" do
181
- formatter.dump_profile
182
- output.string.should =~ /0(\.\d+)? seconds/
183
- end
184
+ it "prints the time" do
185
+ formatter.dump_profile
186
+ output.string.should =~ /0(\.\d+)? seconds/
187
+ end
184
188
 
185
- it "prints the path" do
186
- formatter.dump_profile
187
- filename = __FILE__.split(File::SEPARATOR).last
189
+ it "prints the path" do
190
+ formatter.dump_profile
191
+ filename = __FILE__.split(File::SEPARATOR).last
188
192
 
189
- output.string.should =~ /#{filename}\:#{__LINE__ - 21}/
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: 7712002
4
+ hash: 62196377
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 2
8
8
  - 6
9
- - 2
10
- - rc
11
- version: 2.6.2.rc
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-20 00:00:00 -04:00
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.2.rc
249
+ summary: rspec-core-2.6.3.beta1
248
250
  test_files:
249
251
  - features/Autotest.md
250
252
  - features/Changelog.md