rspec-core 2.0.0.beta.12 → 2.0.0.beta.13
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/.gitignore +1 -0
- data/Gemfile +14 -0
- data/Rakefile +15 -12
- data/VERSION +1 -1
- data/features/command_line/example_name_option.feature +17 -3
- data/features/command_line/exit_status.feature +49 -0
- data/features/hooks/before_and_after_hooks.feature +51 -19
- data/features/hooks/halt.feature +1 -1
- data/features/support/env.rb +5 -3
- data/lib/rspec/core/command_line.rb +14 -5
- data/lib/rspec/core/configuration.rb +14 -24
- data/lib/rspec/core/configuration_options.rb +13 -8
- data/lib/rspec/core/drb_command_line.rb +2 -3
- data/lib/rspec/core/example.rb +5 -5
- data/lib/rspec/core/example_group.rb +23 -25
- data/lib/rspec/core/formatters/base_text_formatter.rb +13 -4
- data/lib/rspec/core/hooks.rb +57 -24
- data/lib/rspec/core/metadata.rb +1 -1
- data/lib/rspec/core/pending.rb +3 -3
- data/lib/rspec/core/rake_task.rb +48 -11
- data/lib/rspec/core/runner.rb +19 -8
- data/lib/rspec/core/subject.rb +3 -3
- data/lib/rspec/core/world.rb +3 -7
- data/rspec-core.gemspec +16 -12
- data/spec/rspec/core/command_line_spec.rb +72 -0
- data/spec/rspec/core/configuration_options_spec.rb +12 -3
- data/spec/rspec/core/configuration_spec.rb +6 -1
- data/spec/rspec/core/deprecations_spec.rb +19 -0
- data/spec/rspec/core/drb_command_line_spec.rb +1 -1
- data/spec/rspec/core/example_group_spec.rb +120 -12
- data/spec/rspec/core/example_spec.rb +27 -17
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +23 -0
- data/spec/rspec/core/metadata_spec.rb +32 -0
- data/spec/rspec/core/runner_spec.rb +2 -1
- data/spec/rspec/core/shared_example_group_spec.rb +1 -1
- data/spec/spec_helper.rb +49 -51
- data/specs.watchr +1 -1
- metadata +31 -27
@@ -3,6 +3,29 @@ require "spec_helper"
|
|
3
3
|
module RSpec::Core::Formatters
|
4
4
|
|
5
5
|
describe BaseTextFormatter do
|
6
|
+
describe "#summary_line" do
|
7
|
+
let(:output) { StringIO.new }
|
8
|
+
let(:formatter) { RSpec::Core::Formatters::BaseTextFormatter.new(output) }
|
9
|
+
|
10
|
+
context "with 0s" do
|
11
|
+
it "outputs pluralized (excluding pending)" do
|
12
|
+
formatter.summary_line(0,0,0).should eq("0 examples, 0 failures")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "with 1s" do
|
17
|
+
it "outputs singular (including pending)" do
|
18
|
+
formatter.summary_line(1,1,1).should eq("1 example, 1 failure, 1 pending")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "with 2s" do
|
23
|
+
it "outputs pluralized (including pending)" do
|
24
|
+
formatter.summary_line(2,2,2).should eq("2 examples, 2 failures, 2 pending")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
6
29
|
describe "#dump_failures" do
|
7
30
|
it "preserves formatting" do
|
8
31
|
output = StringIO.new
|
@@ -25,6 +25,38 @@ module RSpec
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
describe "describes" do
|
29
|
+
context "with a String" do
|
30
|
+
it "returns nil" do
|
31
|
+
m = Metadata.new
|
32
|
+
m.process('group')
|
33
|
+
|
34
|
+
m = m.for_example("example", {})
|
35
|
+
m[:example_group][:describes].should be_nil
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "with a Symbol" do
|
40
|
+
it "returns nil" do
|
41
|
+
m = Metadata.new
|
42
|
+
m.process(:group)
|
43
|
+
|
44
|
+
m = m.for_example("example", {})
|
45
|
+
m[:example_group][:describes].should be_nil
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "with a class" do
|
50
|
+
it "returns the class" do
|
51
|
+
m = Metadata.new
|
52
|
+
m.process(String)
|
53
|
+
|
54
|
+
m = m.for_example("example", {})
|
55
|
+
m[:example_group][:describes].should be(String)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
28
60
|
describe "full description" do
|
29
61
|
it "concats the example group name and description" do
|
30
62
|
m = Metadata.new
|
@@ -6,6 +6,7 @@ module RSpec::Core
|
|
6
6
|
it 'sets an at_exit hook if none is already set' do
|
7
7
|
RSpec::Core::Runner.stub(:installed_at_exit?).and_return(false)
|
8
8
|
RSpec::Core::Runner.stub(:running_in_drb?).and_return(false)
|
9
|
+
RSpec::Core::Runner.stub(:at_exit_hook_disabled?).and_return(false)
|
9
10
|
RSpec::Core::Runner.should_receive(:at_exit)
|
10
11
|
RSpec::Core::Runner.autorun
|
11
12
|
end
|
@@ -13,6 +14,7 @@ module RSpec::Core
|
|
13
14
|
it 'does not set the at_exit hook if it is already set' do
|
14
15
|
RSpec::Core::Runner.stub(:installed_at_exit?).and_return(true)
|
15
16
|
RSpec::Core::Runner.stub(:running_in_drb?).and_return(false)
|
17
|
+
RSpec::Core::Runner.stub(:at_exit_hook_disabled?).and_return(false)
|
16
18
|
RSpec::Core::Runner.should_receive(:at_exit).never
|
17
19
|
RSpec::Core::Runner.autorun
|
18
20
|
end
|
@@ -24,7 +26,6 @@ module RSpec::Core
|
|
24
26
|
@err = @out = StringIO.new
|
25
27
|
|
26
28
|
@options = RSpec::Core::ConfigurationOptions.new(%w[--drb --drb-port 8181 --color])
|
27
|
-
@options.parse_options
|
28
29
|
RSpec::Core::ConfigurationOptions.stub(:new) { @options }
|
29
30
|
|
30
31
|
@drb_proxy = double(RSpec::Core::DRbCommandLine, :run => true)
|
@@ -172,7 +172,7 @@ module RSpec::Core
|
|
172
172
|
it "has one example" do; end
|
173
173
|
it "has another example" do; end
|
174
174
|
it "includes modules, included into shared example_group, into current example_group", :compat => 'rspec-1.2' do
|
175
|
-
raise "FAIL" unless
|
175
|
+
raise "FAIL" unless example.example_group.included_modules.include?(RunningSharedExamplesJustForTesting)
|
176
176
|
end
|
177
177
|
end
|
178
178
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,72 +1,70 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require 'spork'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
require 'rspec/core'
|
3
|
+
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
4
|
+
require 'rspec/core'
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
$LOAD_PATH << File.expand_path('../../../rspec-expectations/lib', __FILE__)
|
7
|
+
$LOAD_PATH << File.expand_path('../../../rspec-mocks/lib', __FILE__)
|
8
|
+
require 'rspec/expectations'
|
9
|
+
require 'rspec/mocks'
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
begin
|
12
|
+
require 'autotest'
|
13
|
+
rescue LoadError
|
14
|
+
raise "Could not load autotest."
|
15
|
+
end
|
18
16
|
|
19
|
-
|
17
|
+
require 'autotest/rspec2'
|
20
18
|
|
21
|
-
|
19
|
+
Dir['./spec/support/**/*.rb'].map {|f| require f}
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
module RSpec
|
22
|
+
module Core
|
23
|
+
module Matchers
|
24
|
+
def fail
|
25
|
+
raise_error(::RSpec::Expectations::ExpectationNotMetError)
|
26
|
+
end
|
29
27
|
|
30
|
-
|
31
|
-
|
32
|
-
end
|
28
|
+
def fail_with(message)
|
29
|
+
raise_error(::RSpec::Expectations::ExpectationNotMetError, message)
|
33
30
|
end
|
34
31
|
end
|
35
32
|
end
|
33
|
+
end
|
36
34
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
35
|
+
class NullObject
|
36
|
+
def method_missing(method, *args, &block)
|
37
|
+
# ignore
|
41
38
|
end
|
39
|
+
end
|
42
40
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
41
|
+
class RSpec::Core::ExampleGroup
|
42
|
+
def self.run_all(reporter=nil)
|
43
|
+
run(reporter || NullObject.new)
|
47
44
|
end
|
45
|
+
end
|
48
46
|
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
def in_editor?
|
48
|
+
ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM')
|
49
|
+
end
|
52
50
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
51
|
+
RSpec.configure do |c|
|
52
|
+
c.color_enabled = !in_editor?
|
53
|
+
c.filter_run :focus => true
|
54
|
+
c.run_all_when_everything_filtered = true
|
55
|
+
c.filter_run_excluding :ruby => lambda {|version|
|
56
|
+
case version.to_s
|
57
|
+
when "!ruby"
|
58
|
+
RUBY_ENGINE != "jruby"
|
59
|
+
else
|
58
60
|
!(RUBY_VERSION.to_s =~ /^#{version.to_s}/)
|
59
|
-
}
|
60
|
-
c.before(:each) do
|
61
|
-
@real_world = RSpec.world
|
62
|
-
RSpec.instance_variable_set(:@world, RSpec::Core::World.new)
|
63
|
-
end
|
64
|
-
c.after(:each) do
|
65
|
-
RSpec.instance_variable_set(:@world, @real_world)
|
66
61
|
end
|
62
|
+
}
|
63
|
+
c.before(:each) do
|
64
|
+
@real_world = RSpec.world
|
65
|
+
RSpec.instance_variable_set(:@world, RSpec::Core::World.new)
|
66
|
+
end
|
67
|
+
c.after(:each) do
|
68
|
+
RSpec.instance_variable_set(:@world, @real_world)
|
67
69
|
end
|
68
70
|
end
|
69
|
-
|
70
|
-
Spork.each_run do
|
71
|
-
end
|
72
|
-
|
data/specs.watchr
CHANGED
metadata
CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
|
|
7
7
|
- 0
|
8
8
|
- 0
|
9
9
|
- beta
|
10
|
-
-
|
11
|
-
version: 2.0.0.beta.
|
10
|
+
- 13
|
11
|
+
version: 2.0.0.beta.13
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Chad Humphries
|
@@ -17,13 +17,13 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-06-
|
20
|
+
date: 2010-06-23 00:00:00 -05:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
|
+
type: :development
|
24
25
|
name: rspec-expectations
|
25
|
-
|
26
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
28
|
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
@@ -32,14 +32,14 @@ dependencies:
|
|
32
32
|
- 0
|
33
33
|
- 0
|
34
34
|
- beta
|
35
|
-
-
|
36
|
-
version: 2.0.0.beta.
|
37
|
-
|
38
|
-
|
35
|
+
- 13
|
36
|
+
version: 2.0.0.beta.13
|
37
|
+
requirement: *id001
|
38
|
+
prerelease: false
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
|
+
type: :development
|
40
41
|
name: rspec-mocks
|
41
|
-
|
42
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
@@ -48,14 +48,14 @@ dependencies:
|
|
48
48
|
- 0
|
49
49
|
- 0
|
50
50
|
- beta
|
51
|
-
-
|
52
|
-
version: 2.0.0.beta.
|
53
|
-
|
54
|
-
|
51
|
+
- 13
|
52
|
+
version: 2.0.0.beta.13
|
53
|
+
requirement: *id002
|
54
|
+
prerelease: false
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
type: :development
|
56
57
|
name: cucumber
|
57
|
-
|
58
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
58
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
@@ -64,12 +64,12 @@ dependencies:
|
|
64
64
|
- 5
|
65
65
|
- 3
|
66
66
|
version: 0.5.3
|
67
|
-
|
68
|
-
|
67
|
+
requirement: *id003
|
68
|
+
prerelease: false
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
+
type: :development
|
70
71
|
name: autotest
|
71
|
-
|
72
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
@@ -78,9 +78,9 @@ dependencies:
|
|
78
78
|
- 2
|
79
79
|
- 9
|
80
80
|
version: 4.2.9
|
81
|
-
|
82
|
-
|
83
|
-
description: RSpec runner and example
|
81
|
+
requirement: *id004
|
82
|
+
prerelease: false
|
83
|
+
description: RSpec runner and example groups
|
84
84
|
email: dchelimsky@gmail.com;chad.humphries@gmail.com
|
85
85
|
executables:
|
86
86
|
- rspec
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- .gitignore
|
95
95
|
- .rspec
|
96
96
|
- .treasure_map.rb
|
97
|
+
- Gemfile
|
97
98
|
- License.txt
|
98
99
|
- README.markdown
|
99
100
|
- Rakefile
|
@@ -104,6 +105,7 @@ files:
|
|
104
105
|
- bin/spec
|
105
106
|
- cucumber.yml
|
106
107
|
- features/command_line/example_name_option.feature
|
108
|
+
- features/command_line/exit_status.feature
|
107
109
|
- features/command_line/line_number_appended_to_path.feature
|
108
110
|
- features/command_line/line_number_option.feature
|
109
111
|
- features/configuration/custom_settings.feature
|
@@ -168,6 +170,7 @@ files:
|
|
168
170
|
- script/console
|
169
171
|
- spec/autotest/failed_results_re_spec.rb
|
170
172
|
- spec/autotest/rspec_spec.rb
|
173
|
+
- spec/rspec/core/command_line_spec.rb
|
171
174
|
- spec/rspec/core/configuration_options_spec.rb
|
172
175
|
- spec/rspec/core/configuration_spec.rb
|
173
176
|
- spec/rspec/core/deprecations_spec.rb
|
@@ -201,13 +204,13 @@ files:
|
|
201
204
|
- spec/support/matchers.rb
|
202
205
|
- specs.watchr
|
203
206
|
has_rdoc: true
|
204
|
-
homepage: http://github.com/rspec/core
|
207
|
+
homepage: http://github.com/rspec/rspec-core
|
205
208
|
licenses: []
|
206
209
|
|
207
210
|
post_install_message: |
|
208
211
|
**************************************************
|
209
212
|
|
210
|
-
Thank you for installing rspec-core-2.0.0.beta.
|
213
|
+
Thank you for installing rspec-core-2.0.0.beta.13
|
211
214
|
|
212
215
|
**************************************************
|
213
216
|
|
@@ -237,10 +240,11 @@ rubyforge_project: rspec
|
|
237
240
|
rubygems_version: 1.3.6
|
238
241
|
signing_key:
|
239
242
|
specification_version: 3
|
240
|
-
summary: rspec-core-2.0.0.beta.
|
243
|
+
summary: rspec-core-2.0.0.beta.13
|
241
244
|
test_files:
|
242
245
|
- spec/autotest/failed_results_re_spec.rb
|
243
246
|
- spec/autotest/rspec_spec.rb
|
247
|
+
- spec/rspec/core/command_line_spec.rb
|
244
248
|
- spec/rspec/core/configuration_options_spec.rb
|
245
249
|
- spec/rspec/core/configuration_spec.rb
|
246
250
|
- spec/rspec/core/deprecations_spec.rb
|