rspec-core 2.0.0.beta.16 → 2.0.0.beta.17
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 +3 -4
- data/README.markdown +5 -2
- data/Rakefile +8 -0
- data/VERSION +1 -1
- data/features/support/env.rb +0 -17
- data/lib/rspec/core/command_line.rb +5 -1
- data/lib/rspec/core/example.rb +7 -11
- data/lib/rspec/core/example_group.rb +13 -2
- data/lib/rspec/core/formatters/base_formatter.rb +1 -1
- data/lib/rspec/core/hooks.rb +72 -31
- data/rspec-core.gemspec +12 -10
- data/spec/rspec/core/command_line_spec.rb +49 -0
- data/spec/rspec/core/command_line_spec_output.txt +0 -0
- data/spec/rspec/core/example_spec.rb +23 -0
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +280 -0
- data/spec/spec_helper.rb +0 -3
- metadata +14 -12
data/Gemfile
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
gem "bundler"
|
4
3
|
gem "rake"
|
5
4
|
gem "jeweler"
|
6
5
|
gem "cucumber"
|
7
|
-
gem "aruba",
|
6
|
+
gem "aruba", ">= 0.2.0"
|
8
7
|
gem "autotest"
|
9
8
|
gem "watchr"
|
10
9
|
gem "rcov"
|
@@ -16,8 +15,8 @@ gem "syntax"
|
|
16
15
|
gem "rspec-core", :path => "."
|
17
16
|
gem "rspec-expectations", :path => "../rspec-expectations"
|
18
17
|
gem "rspec-mocks", :path => "../rspec-mocks"
|
19
|
-
if RUBY_VERSION.to_s =~ /1.9
|
18
|
+
if RUBY_VERSION.to_s =~ /1.9/
|
20
19
|
gem "ruby-debug19"
|
21
|
-
|
20
|
+
else
|
22
21
|
gem "ruby-debug"
|
23
22
|
end
|
data/README.markdown
CHANGED
@@ -72,10 +72,13 @@ is a feature that is not documented there, or you find them insufficient to
|
|
72
72
|
understand how to use a feature, please submit issues to
|
73
73
|
[http://github.com/rspec/rspec-core/issues](http://github.com/rspec/rspec-core/issues).
|
74
74
|
|
75
|
-
|
75
|
+
## Contribute
|
76
|
+
|
77
|
+
See [http://github.com/rspec/rspec-dev](http://github.com/rspec/rspec-dev)
|
78
|
+
|
79
|
+
## Also see
|
76
80
|
|
77
81
|
* [http://github.com/rspec/rspec](http://github.com/rspec/rspec)
|
78
82
|
* [http://github.com/rspec/rspec-expectations](http://github.com/rspec/rspec-expectations)
|
79
83
|
* [http://github.com/rspec/rspec-mocks](http://github.com/rspec/rspec-mocks)
|
80
|
-
* [http://github.com/rspec/rspec-dev](http://github.com/rspec/rspec-dev)
|
81
84
|
|
data/Rakefile
CHANGED
@@ -65,6 +65,14 @@ task :clobber do
|
|
65
65
|
rm_rf 'coverage'
|
66
66
|
end
|
67
67
|
|
68
|
+
class Cucumber::Rake::Task::ForkedCucumberRunner
|
69
|
+
# When cucumber shells out, we still need it to run in the context of our
|
70
|
+
# bundle.
|
71
|
+
def run
|
72
|
+
sh "bundle exec #{RUBY} " + args.join(" ")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
68
76
|
if RUBY_VERSION.to_f >= 1.9
|
69
77
|
Cucumber::Rake::Task.new(:cucumber) do |t|
|
70
78
|
t.cucumber_opts = %w{--format progress}
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0.beta.
|
1
|
+
2.0.0.beta.17
|
data/features/support/env.rb
CHANGED
@@ -1,18 +1 @@
|
|
1
|
-
require "bundler"
|
2
|
-
Bundler.setup
|
3
|
-
|
4
1
|
require 'aruba'
|
5
|
-
require 'rspec/expectations'
|
6
|
-
|
7
|
-
module ArubaOverrides
|
8
|
-
def detect_ruby_script(cmd)
|
9
|
-
if cmd =~ /^rspec /
|
10
|
-
"bundle exec ../../bin/#{cmd}"
|
11
|
-
else
|
12
|
-
super(cmd)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
World(ArubaOverrides)
|
18
|
-
|
@@ -2,6 +2,10 @@ module RSpec
|
|
2
2
|
module Core
|
3
3
|
class CommandLine
|
4
4
|
def initialize(options, configuration=RSpec::configuration, world=RSpec::world)
|
5
|
+
if Array === options
|
6
|
+
options = ConfigurationOptions.new(options)
|
7
|
+
options.parse_options
|
8
|
+
end
|
5
9
|
@options = options
|
6
10
|
@configuration = configuration
|
7
11
|
@world = world
|
@@ -10,7 +14,7 @@ module RSpec
|
|
10
14
|
def run(err, out)
|
11
15
|
@options.configure(@configuration)
|
12
16
|
@configuration.error_stream = err
|
13
|
-
@configuration.output_stream
|
17
|
+
@configuration.output_stream ||= out
|
14
18
|
@configuration.require_files_to_run
|
15
19
|
@configuration.configure_mock_framework
|
16
20
|
@world.announce_inclusion_filter
|
data/lib/rspec/core/example.rb
CHANGED
@@ -49,7 +49,7 @@ module RSpec
|
|
49
49
|
@in_block = true
|
50
50
|
with_pending_capture &@example_block
|
51
51
|
rescue Exception => e
|
52
|
-
|
52
|
+
set_exception(e)
|
53
53
|
ensure
|
54
54
|
@in_block = false
|
55
55
|
run_after_each
|
@@ -60,7 +60,7 @@ module RSpec
|
|
60
60
|
end.call
|
61
61
|
end
|
62
62
|
rescue Exception => e
|
63
|
-
|
63
|
+
set_exception(e)
|
64
64
|
ensure
|
65
65
|
@example_group_instance.example = nil
|
66
66
|
assign_auto_description
|
@@ -69,6 +69,10 @@ module RSpec
|
|
69
69
|
finish(reporter)
|
70
70
|
end
|
71
71
|
|
72
|
+
def set_exception(exception)
|
73
|
+
@exception ||= exception
|
74
|
+
end
|
75
|
+
|
72
76
|
private
|
73
77
|
|
74
78
|
def with_pending_capture
|
@@ -79,15 +83,7 @@ module RSpec
|
|
79
83
|
end
|
80
84
|
|
81
85
|
def with_around_hooks(&wrapped_example)
|
82
|
-
|
83
|
-
def wrapper.run; call; end
|
84
|
-
lambda { @example_group_instance.instance_exec(wrapper, &hook) }
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def around_hooks_for(example_group_class)
|
89
|
-
(RSpec.configuration.hooks[:around][:each] +
|
90
|
-
@example_group_class.ancestors.reverse.map{|a| a.hooks[:around][:each]}).flatten
|
86
|
+
@example_group_class.eval_around_eachs(@example_group_instance, wrapped_example)
|
91
87
|
end
|
92
88
|
|
93
89
|
def start(reporter)
|
@@ -145,7 +145,7 @@ module RSpec
|
|
145
145
|
superclass.before_all_ivars.each { |ivar, val| example.instance_variable_set(ivar, val) }
|
146
146
|
world.run_hook_filtered(:before, :all, self, example)
|
147
147
|
|
148
|
-
run_hook!(:before, :all, example
|
148
|
+
run_hook!(:before, :all, example)
|
149
149
|
example.instance_variables.each { |ivar| before_all_ivars[ivar] = example.instance_variable_get(ivar) }
|
150
150
|
end
|
151
151
|
|
@@ -155,10 +155,21 @@ module RSpec
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def self.eval_after_eachs(example)
|
158
|
-
ancestors.each { |ancestor| ancestor.run_hook(:after, :each, example
|
158
|
+
ancestors.each { |ancestor| ancestor.run_hook(:after, :each, example) }
|
159
159
|
world.run_hook_filtered(:after, :each, self, example)
|
160
160
|
end
|
161
161
|
|
162
|
+
def self.eval_around_eachs(example_group_instance, wrapped_example)
|
163
|
+
around_hooks.reverse.inject(wrapped_example) do |wrapper, hook|
|
164
|
+
def wrapper.run; call; end
|
165
|
+
lambda { example_group_instance.instance_exec(wrapper, &hook) }
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def self.around_hooks
|
170
|
+
(world.find_hook(:around, :each, self) + ancestors.reverse.map{|a| a.find_hook(:around, :each, self)}).flatten
|
171
|
+
end
|
172
|
+
|
162
173
|
def self.eval_after_alls(example)
|
163
174
|
return if descendant_filtered_examples.empty?
|
164
175
|
before_all_ivars.each { |ivar, val| example.instance_variable_set(ivar, val) }
|
data/lib/rspec/core/hooks.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module RSpec
|
2
2
|
module Core
|
3
3
|
module Hooks
|
4
|
+
|
4
5
|
class Hook
|
5
6
|
attr_reader :options
|
6
7
|
|
@@ -13,69 +14,109 @@ module RSpec
|
|
13
14
|
!group || group.all_apply?(options)
|
14
15
|
end
|
15
16
|
|
17
|
+
def to_proc
|
18
|
+
@block
|
19
|
+
end
|
20
|
+
|
16
21
|
def call
|
17
22
|
@block.call
|
18
23
|
end
|
24
|
+
end
|
19
25
|
|
20
|
-
|
21
|
-
|
26
|
+
class BeforeHook < Hook
|
27
|
+
def run_in(example)
|
28
|
+
example ? example.instance_eval(&self) : call
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class AfterHook < Hook
|
33
|
+
def run_in(example)
|
34
|
+
if example
|
35
|
+
begin
|
36
|
+
example.instance_eval(&self)
|
37
|
+
rescue Exception => e
|
38
|
+
if example.respond_to?(:example)
|
39
|
+
example.example.set_exception(e)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
else
|
43
|
+
call
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class AroundHook < Hook
|
49
|
+
def call(wrapped_example)
|
50
|
+
@block.call(wrapped_example)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class HookCollection < Array
|
55
|
+
def find_hooks_for(group)
|
56
|
+
dup.reject {|hook| !hook.options_apply?(group)}
|
22
57
|
end
|
23
58
|
end
|
24
59
|
|
60
|
+
class BeforeHooks < HookCollection
|
61
|
+
def run_all(example)
|
62
|
+
each {|h| h.run_in(example) }
|
63
|
+
end
|
64
|
+
|
65
|
+
def run_all!(example)
|
66
|
+
shift.run_in(example) until empty?
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class AfterHooks < HookCollection
|
71
|
+
def run_all(example)
|
72
|
+
reverse.each {|h| h.run_in(example) }
|
73
|
+
end
|
74
|
+
|
75
|
+
def run_all!(example)
|
76
|
+
pop.run_in(example) until empty?
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class AroundHooks < HookCollection; end
|
81
|
+
|
25
82
|
def hooks
|
26
83
|
@hooks ||= {
|
27
|
-
:around => { :each =>
|
28
|
-
:before => { :each =>
|
29
|
-
:after => { :each =>
|
84
|
+
:around => { :each => AroundHooks.new },
|
85
|
+
:before => { :each => BeforeHooks.new, :all => BeforeHooks.new, :suite => BeforeHooks.new },
|
86
|
+
:after => { :each => AfterHooks.new, :all => AfterHooks.new, :suite => AfterHooks.new }
|
30
87
|
}
|
31
88
|
end
|
32
89
|
|
33
90
|
def before(scope=:each, options={}, &block)
|
34
|
-
hooks[:before][scope] <<
|
91
|
+
hooks[:before][scope] << BeforeHook.new(options, block)
|
35
92
|
end
|
36
93
|
|
37
94
|
def after(scope=:each, options={}, &block)
|
38
|
-
hooks[:after][scope] <<
|
95
|
+
hooks[:after][scope] << AfterHook.new(options, block)
|
39
96
|
end
|
40
97
|
|
41
|
-
def around(scope=:each, &block)
|
42
|
-
hooks[:around][scope] << block
|
98
|
+
def around(scope=:each, options={}, &block)
|
99
|
+
hooks[:around][scope] << AroundHook.new(options, block)
|
43
100
|
end
|
44
101
|
|
45
102
|
# Runs all of the blocks stored with the hook in the context of the
|
46
103
|
# example. If no example is provided, just calls the hook directly.
|
47
|
-
def run_hook(hook, scope, example=nil
|
48
|
-
|
49
|
-
hooks[hook][scope].reverse.each &run_hook_in(example)
|
50
|
-
else
|
51
|
-
hooks[hook][scope].each &run_hook_in(example)
|
52
|
-
end
|
104
|
+
def run_hook(hook, scope, example=nil)
|
105
|
+
hooks[hook][scope].run_all(example)
|
53
106
|
end
|
54
107
|
|
55
108
|
# Just like run_hook, except it removes the blocks as it evalutes them,
|
56
109
|
# ensuring that they will only be run once.
|
57
|
-
def run_hook!(hook, scope, example
|
58
|
-
|
59
|
-
if options[:reverse]
|
60
|
-
example.instance_eval &hooks[hook][scope].shift
|
61
|
-
else
|
62
|
-
example.instance_eval &hooks[hook][scope].pop
|
63
|
-
end
|
64
|
-
end
|
110
|
+
def run_hook!(hook, scope, example)
|
111
|
+
hooks[hook][scope].run_all!(example)
|
65
112
|
end
|
66
113
|
|
67
114
|
def run_hook_filtered(hook, scope, group, example)
|
68
|
-
find_hook(hook, scope, group).
|
115
|
+
find_hook(hook, scope, group).run_all(example)
|
69
116
|
end
|
70
117
|
|
71
118
|
def find_hook(hook, scope, group)
|
72
|
-
hooks[hook][scope].
|
73
|
-
end
|
74
|
-
|
75
|
-
private
|
76
|
-
|
77
|
-
def run_hook_in(example)
|
78
|
-
lambda {|hook| example ? example.instance_eval(&hook) : hook.call}
|
119
|
+
hooks[hook][scope].find_hooks_for(group)
|
79
120
|
end
|
80
121
|
end
|
81
122
|
end
|
data/rspec-core.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rspec-core}
|
8
|
-
s.version = "2.0.0.beta.
|
8
|
+
s.version = "2.0.0.beta.17"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Chad Humphries", "David Chelimsky"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-11}
|
13
13
|
s.default_executable = %q{rspec}
|
14
14
|
s.description = %q{RSpec runner and example groups}
|
15
15
|
s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
|
@@ -103,6 +103,7 @@ Gem::Specification.new do |s|
|
|
103
103
|
"spec/autotest/failed_results_re_spec.rb",
|
104
104
|
"spec/autotest/rspec_spec.rb",
|
105
105
|
"spec/rspec/core/command_line_spec.rb",
|
106
|
+
"spec/rspec/core/command_line_spec_output.txt",
|
106
107
|
"spec/rspec/core/configuration_options_spec.rb",
|
107
108
|
"spec/rspec/core/configuration_spec.rb",
|
108
109
|
"spec/rspec/core/core_spec.rb",
|
@@ -121,6 +122,7 @@ Gem::Specification.new do |s|
|
|
121
122
|
"spec/rspec/core/formatters/progress_formatter_spec.rb",
|
122
123
|
"spec/rspec/core/formatters/snippet_extractor_spec.rb",
|
123
124
|
"spec/rspec/core/formatters/text_mate_formatted-1.8.7.html",
|
125
|
+
"spec/rspec/core/formatters/text_mate_formatted-1.9.2.html",
|
124
126
|
"spec/rspec/core/formatters/text_mate_formatter_spec.rb",
|
125
127
|
"spec/rspec/core/hooks_spec.rb",
|
126
128
|
"spec/rspec/core/kernel_extensions_spec.rb",
|
@@ -147,7 +149,7 @@ Gem::Specification.new do |s|
|
|
147
149
|
s.homepage = %q{http://github.com/rspec/rspec-core}
|
148
150
|
s.post_install_message = %q{**************************************************
|
149
151
|
|
150
|
-
Thank you for installing rspec-core-2.0.0.beta.
|
152
|
+
Thank you for installing rspec-core-2.0.0.beta.17
|
151
153
|
|
152
154
|
**************************************************
|
153
155
|
}
|
@@ -155,7 +157,7 @@ Gem::Specification.new do |s|
|
|
155
157
|
s.require_paths = ["lib"]
|
156
158
|
s.rubyforge_project = %q{rspec}
|
157
159
|
s.rubygems_version = %q{1.3.7}
|
158
|
-
s.summary = %q{rspec-core-2.0.0.beta.
|
160
|
+
s.summary = %q{rspec-core-2.0.0.beta.17}
|
159
161
|
s.test_files = [
|
160
162
|
"spec/autotest/failed_results_re_spec.rb",
|
161
163
|
"spec/autotest/rspec_spec.rb",
|
@@ -202,19 +204,19 @@ Gem::Specification.new do |s|
|
|
202
204
|
s.specification_version = 3
|
203
205
|
|
204
206
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
205
|
-
s.add_development_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.
|
206
|
-
s.add_development_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.
|
207
|
+
s.add_development_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.17"])
|
208
|
+
s.add_development_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.17"])
|
207
209
|
s.add_development_dependency(%q<cucumber>, [">= 0.5.3"])
|
208
210
|
s.add_development_dependency(%q<autotest>, [">= 4.2.9"])
|
209
211
|
else
|
210
|
-
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.
|
211
|
-
s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.
|
212
|
+
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.17"])
|
213
|
+
s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.17"])
|
212
214
|
s.add_dependency(%q<cucumber>, [">= 0.5.3"])
|
213
215
|
s.add_dependency(%q<autotest>, [">= 4.2.9"])
|
214
216
|
end
|
215
217
|
else
|
216
|
-
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.
|
217
|
-
s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.
|
218
|
+
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.17"])
|
219
|
+
s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.17"])
|
218
220
|
s.add_dependency(%q<cucumber>, [">= 0.5.3"])
|
219
221
|
s.add_dependency(%q<autotest>, [">= 4.2.9"])
|
220
222
|
end
|
@@ -1,8 +1,20 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "stringio"
|
3
|
+
require 'tmpdir'
|
3
4
|
|
4
5
|
module RSpec::Core
|
5
6
|
describe CommandLine do
|
7
|
+
context "given an Array of options" do
|
8
|
+
it "assigns ConfigurationOptions built from Array to @options" do
|
9
|
+
config_options = ConfigurationOptions.new(%w[--color])
|
10
|
+
config_options.parse_options
|
11
|
+
|
12
|
+
array_options = %w[--color]
|
13
|
+
command_line = CommandLine.new(array_options)
|
14
|
+
command_line.instance_eval { @options.options }.should eq(config_options.options)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
6
18
|
context "given a ConfigurationOptions object" do
|
7
19
|
it "assigns it to @options" do
|
8
20
|
config_options = ConfigurationOptions.new(%w[--color])
|
@@ -59,6 +71,43 @@ module RSpec::Core
|
|
59
71
|
after_suite_called.should be_true
|
60
72
|
end
|
61
73
|
end
|
74
|
+
|
75
|
+
describe "#run with custom output" do
|
76
|
+
let(:config_options) do
|
77
|
+
config_options = ConfigurationOptions.new(%w[--color])
|
78
|
+
config_options.parse_options
|
79
|
+
config_options
|
80
|
+
end
|
81
|
+
|
82
|
+
let(:command_line) do
|
83
|
+
CommandLine.new(config_options, config)
|
84
|
+
end
|
85
|
+
|
86
|
+
let(:output_file_path) do
|
87
|
+
Dir.tmpdir + "/command_line_spec_output.txt"
|
88
|
+
end
|
89
|
+
|
90
|
+
let(:output_file) do
|
91
|
+
File.new(output_file_path, 'w')
|
92
|
+
end
|
93
|
+
|
94
|
+
let(:config) do
|
95
|
+
config = RSpec::Core::Configuration.new
|
96
|
+
config.output_stream = output_file
|
97
|
+
config
|
98
|
+
end
|
99
|
+
|
100
|
+
let(:out) { ::StringIO.new }
|
62
101
|
|
102
|
+
before do
|
103
|
+
config.stub(:run_hook)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "doesn't override output_stream" do
|
107
|
+
command_line.run(out, out)
|
108
|
+
command_line.instance_eval { @configuration.output_stream }.should eql(output_file)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
63
112
|
end
|
64
113
|
end
|
File without changes
|
@@ -82,6 +82,29 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
82
82
|
after_run.should be_true, "expected after(:each) to be run"
|
83
83
|
end
|
84
84
|
|
85
|
+
context "with an after(:each) that raises" do
|
86
|
+
it "runs subsequent after(:each)'s" do
|
87
|
+
after_run = false
|
88
|
+
group = RSpec::Core::ExampleGroup.describe do
|
89
|
+
after(:each) { after_run = true }
|
90
|
+
after(:each) { raise "FOO" }
|
91
|
+
example('example') { 1.should == 1 }
|
92
|
+
end
|
93
|
+
group.run_all
|
94
|
+
after_run.should be_true, "expected after(:each) to be run"
|
95
|
+
end
|
96
|
+
|
97
|
+
it "stores the exception" do
|
98
|
+
group = RSpec::Core::ExampleGroup.describe
|
99
|
+
group.after(:each) { raise "FOO" }
|
100
|
+
example = group.example('example') { 1.should == 1 }
|
101
|
+
|
102
|
+
group.run_all
|
103
|
+
|
104
|
+
example.metadata[:execution_result][:exception_encountered].message.should == "FOO"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
85
108
|
it "wraps before/after(:each) inside around" do
|
86
109
|
results = []
|
87
110
|
group = RSpec::Core::ExampleGroup.describe do
|
@@ -0,0 +1,280 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
+
<head>
|
7
|
+
<title>RSpec results</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
9
|
+
<meta http-equiv="Expires" content="-1" />
|
10
|
+
<meta http-equiv="Pragma" content="no-cache" />
|
11
|
+
<style type="text/css">
|
12
|
+
body {
|
13
|
+
margin: 0;
|
14
|
+
padding: 0;
|
15
|
+
background: #fff;
|
16
|
+
font-size: 80%;
|
17
|
+
}
|
18
|
+
</style>
|
19
|
+
<script type="text/javascript">
|
20
|
+
// <![CDATA[
|
21
|
+
function moveProgressBar(percentDone) {
|
22
|
+
document.getElementById("rspec-header").style.width = percentDone +"%";
|
23
|
+
}
|
24
|
+
function makeRed(element_id) {
|
25
|
+
document.getElementById(element_id).style.background = '#C40D0D';
|
26
|
+
document.getElementById(element_id).style.color = '#FFFFFF';
|
27
|
+
}
|
28
|
+
|
29
|
+
function makeYellow(element_id) {
|
30
|
+
if (element_id == "rspec-header" && document.getElementById(element_id).style.background != '#C40D0D')
|
31
|
+
{
|
32
|
+
document.getElementById(element_id).style.background = '#FAF834';
|
33
|
+
document.getElementById(element_id).style.color = '#000000';
|
34
|
+
}
|
35
|
+
else
|
36
|
+
{
|
37
|
+
document.getElementById(element_id).style.background = '#FAF834';
|
38
|
+
document.getElementById(element_id).style.color = '#000000';
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
// ]]>
|
43
|
+
</script>
|
44
|
+
<style type="text/css">
|
45
|
+
#rspec-header {
|
46
|
+
background: #65C400; color: #fff; height: 4em;
|
47
|
+
}
|
48
|
+
|
49
|
+
.rspec-report h1 {
|
50
|
+
margin: 0px 10px 0px 10px;
|
51
|
+
padding: 10px;
|
52
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
53
|
+
font-size: 1.8em;
|
54
|
+
position: absolute;
|
55
|
+
}
|
56
|
+
|
57
|
+
#summary {
|
58
|
+
margin: 0; padding: 5px 10px;
|
59
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
60
|
+
text-align: right;
|
61
|
+
top: 0px;
|
62
|
+
right: 0px;
|
63
|
+
float:right;
|
64
|
+
}
|
65
|
+
|
66
|
+
#summary p {
|
67
|
+
margin: 0 0 0 2px;
|
68
|
+
}
|
69
|
+
|
70
|
+
#summary #totals {
|
71
|
+
font-size: 1.2em;
|
72
|
+
}
|
73
|
+
|
74
|
+
.example_group {
|
75
|
+
margin: 0 10px 5px;
|
76
|
+
background: #fff;
|
77
|
+
}
|
78
|
+
|
79
|
+
dl {
|
80
|
+
margin: 0; padding: 0 0 5px;
|
81
|
+
font: normal 11px "Lucida Grande", Helvetica, sans-serif;
|
82
|
+
}
|
83
|
+
|
84
|
+
dt {
|
85
|
+
padding: 3px;
|
86
|
+
background: #65C400;
|
87
|
+
color: #fff;
|
88
|
+
font-weight: bold;
|
89
|
+
}
|
90
|
+
|
91
|
+
dd {
|
92
|
+
margin: 5px 0 5px 5px;
|
93
|
+
padding: 3px 3px 3px 18px;
|
94
|
+
}
|
95
|
+
|
96
|
+
dd.spec.passed {
|
97
|
+
border-left: 5px solid #65C400;
|
98
|
+
border-bottom: 1px solid #65C400;
|
99
|
+
background: #DBFFB4; color: #3D7700;
|
100
|
+
}
|
101
|
+
|
102
|
+
dd.spec.failed {
|
103
|
+
border-left: 5px solid #C20000;
|
104
|
+
border-bottom: 1px solid #C20000;
|
105
|
+
color: #C20000; background: #FFFBD3;
|
106
|
+
}
|
107
|
+
|
108
|
+
dd.spec.not_implemented {
|
109
|
+
border-left: 5px solid #FAF834;
|
110
|
+
border-bottom: 1px solid #FAF834;
|
111
|
+
background: #FCFB98; color: #131313;
|
112
|
+
}
|
113
|
+
|
114
|
+
dd.spec.pending_fixed {
|
115
|
+
border-left: 5px solid #0000C2;
|
116
|
+
border-bottom: 1px solid #0000C2;
|
117
|
+
color: #0000C2; background: #D3FBFF;
|
118
|
+
}
|
119
|
+
|
120
|
+
.backtrace {
|
121
|
+
color: #000;
|
122
|
+
font-size: 12px;
|
123
|
+
}
|
124
|
+
|
125
|
+
a {
|
126
|
+
color: #BE5C00;
|
127
|
+
}
|
128
|
+
|
129
|
+
/* Ruby code, style similar to vibrant ink */
|
130
|
+
.ruby {
|
131
|
+
font-size: 12px;
|
132
|
+
font-family: monospace;
|
133
|
+
color: white;
|
134
|
+
background-color: black;
|
135
|
+
padding: 0.1em 0 0.2em 0;
|
136
|
+
}
|
137
|
+
|
138
|
+
.ruby .keyword { color: #FF6600; }
|
139
|
+
.ruby .constant { color: #339999; }
|
140
|
+
.ruby .attribute { color: white; }
|
141
|
+
.ruby .global { color: white; }
|
142
|
+
.ruby .module { color: white; }
|
143
|
+
.ruby .class { color: white; }
|
144
|
+
.ruby .string { color: #66FF00; }
|
145
|
+
.ruby .ident { color: white; }
|
146
|
+
.ruby .method { color: #FFCC00; }
|
147
|
+
.ruby .number { color: white; }
|
148
|
+
.ruby .char { color: white; }
|
149
|
+
.ruby .comment { color: #9933CC; }
|
150
|
+
.ruby .symbol { color: white; }
|
151
|
+
.ruby .regex { color: #44B4CC; }
|
152
|
+
.ruby .punct { color: white; }
|
153
|
+
.ruby .escape { color: white; }
|
154
|
+
.ruby .interp { color: white; }
|
155
|
+
.ruby .expr { color: white; }
|
156
|
+
|
157
|
+
.ruby .offending { background-color: gray; }
|
158
|
+
.ruby .linenum {
|
159
|
+
width: 75px;
|
160
|
+
padding: 0.1em 1em 0.2em 0;
|
161
|
+
color: #000000;
|
162
|
+
background-color: #FFFBD3;
|
163
|
+
}
|
164
|
+
|
165
|
+
</style>
|
166
|
+
</head>
|
167
|
+
<body>
|
168
|
+
<div class="rspec-report">
|
169
|
+
|
170
|
+
<div id="rspec-header">
|
171
|
+
<div id="label">
|
172
|
+
<h1>RSpec Code Examples</h1>
|
173
|
+
</div>
|
174
|
+
|
175
|
+
<div id="summary">
|
176
|
+
<p id="totals"> </p>
|
177
|
+
<p id="duration"> </p>
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
<div class="results">
|
182
|
+
<div class="example_group">
|
183
|
+
<dl>
|
184
|
+
<dt id="example_group_1">pending spec with no implementation</dt>
|
185
|
+
<script type="text/javascript">makeYellow('rspec-header');</script>
|
186
|
+
<script type="text/javascript">makeYellow('example_group_1');</script>
|
187
|
+
<script type="text/javascript">moveProgressBar('20.0');</script>
|
188
|
+
<dd class="spec not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not Yet Implemented)</span></dd>
|
189
|
+
</dl>
|
190
|
+
</div>
|
191
|
+
<div class="example_group">
|
192
|
+
<dl>
|
193
|
+
<dt id="example_group_2">pending command with block format</dt>
|
194
|
+
</dl>
|
195
|
+
</div>
|
196
|
+
<div class="example_group">
|
197
|
+
<dl>
|
198
|
+
<dt id="example_group_3">with content that would fail</dt>
|
199
|
+
<script type="text/javascript">makeYellow('rspec-header');</script>
|
200
|
+
<script type="text/javascript">makeYellow('example_group_3');</script>
|
201
|
+
<script type="text/javascript">moveProgressBar('40.0');</script>
|
202
|
+
<dd class="spec not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
|
203
|
+
</dl>
|
204
|
+
</div>
|
205
|
+
<div class="example_group">
|
206
|
+
<dl>
|
207
|
+
<dt id="example_group_4">with content that would pass</dt>
|
208
|
+
<script type="text/javascript">makeRed('rspec-header');</script>
|
209
|
+
<script type="text/javascript">makeRed('example_group_4');</script>
|
210
|
+
<script type="text/javascript">moveProgressBar('60.0');</script>
|
211
|
+
<dd class="spec pending_fixed">
|
212
|
+
<span class="failed_spec_name">fails</span>
|
213
|
+
<div class="failure" id="failure_0">
|
214
|
+
<div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
|
215
|
+
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=19">./spec/rspec/core/resources/formatter_specs.rb:19</a> :in `block (3 levels) in <top (required)>'
|
216
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=23">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:23</a> :in `block (2 levels) in <module:Formatters>'
|
217
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=43">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:43</a> :in `block (5 levels) in <module:Formatters>'
|
218
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=43">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:43</a> :in `open'
|
219
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=43">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:43</a> :in `block (4 levels) in <module:Formatters>'
|
220
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=42">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:42</a> :in `chdir'
|
221
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=42">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:42</a> :in `block (3 levels) in <module:Formatters>'
|
222
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/spec_helper.rb&line=70">./spec/spec_helper.rb:70</a> :in `block (3 levels) in <top (required)>'
|
223
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/spec_helper.rb&line=46">./spec/spec_helper.rb:46</a> :in `instance_eval'
|
224
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/spec_helper.rb&line=46">./spec/spec_helper.rb:46</a> :in `sandboxed'
|
225
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/spec_helper.rb&line=70">./spec/spec_helper.rb:70</a> :in `block (2 levels) in <top (required)>'</pre></div>
|
226
|
+
<pre class="ruby"><code><span class="linenum">11</span> <span class="keyword">rescue</span> <span class="constant">Exception</span> <span class="punct">=></span> <span class="ident">e</span>
|
227
|
+
<span class="linenum">12</span> <span class="keyword">end</span>
|
228
|
+
<span class="offending"><span class="linenum">13</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
|
229
|
+
<span class="linenum">14</span> <span class="keyword">end</span>
|
230
|
+
<span class="linenum">15</span> <span class="ident">throw</span> <span class="symbol">:pending_declared_in_example</span><span class="punct">,</span> <span class="ident">message</span></code></pre>
|
231
|
+
</div>
|
232
|
+
</dd>
|
233
|
+
</dl>
|
234
|
+
</div>
|
235
|
+
<div class="example_group">
|
236
|
+
<dl>
|
237
|
+
<dt id="example_group_5">passing spec</dt>
|
238
|
+
<script type="text/javascript">moveProgressBar('80.0');</script>
|
239
|
+
<dd class="spec passed"><span class="passed_spec_name">passes</span></dd>
|
240
|
+
</dl>
|
241
|
+
</div>
|
242
|
+
<div class="example_group">
|
243
|
+
<dl>
|
244
|
+
<dt id="example_group_6">failing spec</dt>
|
245
|
+
<script type="text/javascript">makeRed('example_group_6');</script>
|
246
|
+
<script type="text/javascript">moveProgressBar('100.0');</script>
|
247
|
+
<dd class="spec failed">
|
248
|
+
<span class="failed_spec_name">fails</span>
|
249
|
+
<div class="failure" id="failure_0">
|
250
|
+
<div class="message"><pre>
|
251
|
+
expected 2
|
252
|
+
got 1
|
253
|
+
|
254
|
+
(compared using ==)
|
255
|
+
</pre></div>
|
256
|
+
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=34">./spec/rspec/core/resources/formatter_specs.rb:34</a> :in `block (2 levels) in <top (required)>'
|
257
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=23">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:23</a> :in `block (2 levels) in <module:Formatters>'
|
258
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=43">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:43</a> :in `block (5 levels) in <module:Formatters>'
|
259
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=43">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:43</a> :in `open'
|
260
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=43">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:43</a> :in `block (4 levels) in <module:Formatters>'
|
261
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=42">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:42</a> :in `chdir'
|
262
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=42">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:42</a> :in `block (3 levels) in <module:Formatters>'
|
263
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/spec_helper.rb&line=70">./spec/spec_helper.rb:70</a> :in `block (3 levels) in <top (required)>'
|
264
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/spec_helper.rb&line=46">./spec/spec_helper.rb:46</a> :in `instance_eval'
|
265
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/spec_helper.rb&line=46">./spec/spec_helper.rb:46</a> :in `sandboxed'
|
266
|
+
<a href="txmt://open?url=file:///Users/dchelimsky/projects/ruby/rspec2/repos/rspec-core/spec/spec_helper.rb&line=70">./spec/spec_helper.rb:70</a> :in `block (2 levels) in <top (required)>'</pre></div>
|
267
|
+
<pre class="ruby"><code><span class="linenum">27</span> <span class="keyword">end</span>
|
268
|
+
<span class="linenum">28</span>
|
269
|
+
<span class="offending"><span class="linenum">29</span> <span class="keyword">raise</span><span class="punct">(</span><span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Expectations</span><span class="punct">::</span><span class="constant">ExpectationNotMetError</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">))</span></span>
|
270
|
+
<span class="linenum">30</span> <span class="keyword">end</span></code></pre>
|
271
|
+
</div>
|
272
|
+
</dd>
|
273
|
+
</dl>
|
274
|
+
</div>
|
275
|
+
<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>x seconds</strong>";</script>
|
276
|
+
<script type="text/javascript">document.getElementById('totals').innerHTML = "5 examples, 2 failures, 2 pending";</script>
|
277
|
+
</div>
|
278
|
+
</div>
|
279
|
+
</body>
|
280
|
+
</html>
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 62196417
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
9
|
- 0
|
10
10
|
- beta
|
11
|
-
-
|
12
|
-
version: 2.0.0.beta.
|
11
|
+
- 17
|
12
|
+
version: 2.0.0.beta.17
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Chad Humphries
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2010-07-
|
21
|
+
date: 2010-07-11 00:00:00 -05:00
|
22
22
|
default_executable: rspec
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
hash:
|
33
|
+
hash: 62196417
|
34
34
|
segments:
|
35
35
|
- 2
|
36
36
|
- 0
|
37
37
|
- 0
|
38
38
|
- beta
|
39
|
-
-
|
40
|
-
version: 2.0.0.beta.
|
39
|
+
- 17
|
40
|
+
version: 2.0.0.beta.17
|
41
41
|
requirement: *id001
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
type: :development
|
@@ -48,14 +48,14 @@ dependencies:
|
|
48
48
|
requirements:
|
49
49
|
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
hash:
|
51
|
+
hash: 62196417
|
52
52
|
segments:
|
53
53
|
- 2
|
54
54
|
- 0
|
55
55
|
- 0
|
56
56
|
- beta
|
57
|
-
-
|
58
|
-
version: 2.0.0.beta.
|
57
|
+
- 17
|
58
|
+
version: 2.0.0.beta.17
|
59
59
|
requirement: *id002
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
type: :development
|
@@ -183,6 +183,7 @@ files:
|
|
183
183
|
- spec/autotest/failed_results_re_spec.rb
|
184
184
|
- spec/autotest/rspec_spec.rb
|
185
185
|
- spec/rspec/core/command_line_spec.rb
|
186
|
+
- spec/rspec/core/command_line_spec_output.txt
|
186
187
|
- spec/rspec/core/configuration_options_spec.rb
|
187
188
|
- spec/rspec/core/configuration_spec.rb
|
188
189
|
- spec/rspec/core/core_spec.rb
|
@@ -201,6 +202,7 @@ files:
|
|
201
202
|
- spec/rspec/core/formatters/progress_formatter_spec.rb
|
202
203
|
- spec/rspec/core/formatters/snippet_extractor_spec.rb
|
203
204
|
- spec/rspec/core/formatters/text_mate_formatted-1.8.7.html
|
205
|
+
- spec/rspec/core/formatters/text_mate_formatted-1.9.2.html
|
204
206
|
- spec/rspec/core/formatters/text_mate_formatter_spec.rb
|
205
207
|
- spec/rspec/core/hooks_spec.rb
|
206
208
|
- spec/rspec/core/kernel_extensions_spec.rb
|
@@ -230,7 +232,7 @@ licenses: []
|
|
230
232
|
post_install_message: |
|
231
233
|
**************************************************
|
232
234
|
|
233
|
-
Thank you for installing rspec-core-2.0.0.beta.
|
235
|
+
Thank you for installing rspec-core-2.0.0.beta.17
|
234
236
|
|
235
237
|
**************************************************
|
236
238
|
|
@@ -264,7 +266,7 @@ rubyforge_project: rspec
|
|
264
266
|
rubygems_version: 1.3.7
|
265
267
|
signing_key:
|
266
268
|
specification_version: 3
|
267
|
-
summary: rspec-core-2.0.0.beta.
|
269
|
+
summary: rspec-core-2.0.0.beta.17
|
268
270
|
test_files:
|
269
271
|
- spec/autotest/failed_results_re_spec.rb
|
270
272
|
- spec/autotest/rspec_spec.rb
|