rspec-core 2.6.3 → 2.6.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -1
- data/{features/Changelog.md → Changelog.md} +10 -0
- data/Rakefile +2 -0
- data/lib/rspec/core.rb +6 -0
- data/lib/rspec/core/configuration_options.rb +16 -5
- data/lib/rspec/core/{extensions/object.rb → dsl.rb} +2 -4
- data/lib/rspec/core/expecting/with_rspec.rb +0 -2
- data/lib/rspec/core/extensions.rb +0 -1
- data/lib/rspec/core/formatters/base_formatter.rb +8 -4
- data/lib/rspec/core/formatters/base_text_formatter.rb +28 -16
- data/lib/rspec/core/hooks.rb +5 -4
- data/lib/rspec/core/metadata_hash_builder.rb +1 -1
- data/lib/rspec/core/version.rb +1 -1
- data/spec/rspec/core/configuration_options_spec.rb +25 -4
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +126 -123
- data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +16 -20
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +16 -20
- data/spec/spec_helper.rb +0 -1
- metadata +7 -8
data/.travis.yml
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
### 2.6.4 / 2011-06-06
|
2
|
+
|
3
|
+
[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.3...v2.6.4)
|
4
|
+
|
5
|
+
* Bug fixes
|
6
|
+
* Support exclusion filters in DRb. (Yann Lugrin)
|
7
|
+
* Fix --example escaping when run over DRb. (Elliot Winkler)
|
8
|
+
* Use standard ANSI codes for color formatting so colors work in a wider set
|
9
|
+
of color schemes.
|
10
|
+
|
1
11
|
### 2.6.3 / 2011-05-24
|
2
12
|
|
3
13
|
[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.2...v2.6.3)
|
data/Rakefile
CHANGED
@@ -79,7 +79,9 @@ end
|
|
79
79
|
desc "Push docs/cukes to relishapp using the relish-client-gem"
|
80
80
|
task :relish, :version do |t, args|
|
81
81
|
raise "rake relish[VERSION]" unless args[:version]
|
82
|
+
sh "cp Changelog.md features/"
|
82
83
|
sh "relish push rspec/rspec-core:#{args[:version]}"
|
84
|
+
sh "rm features/Changelog.md"
|
83
85
|
end
|
84
86
|
|
85
87
|
Rake::RDocTask.new do |rdoc|
|
data/lib/rspec/core.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rspec/core/dsl'
|
1
2
|
require 'rspec/core/extensions'
|
2
3
|
require 'rspec/core/load_path'
|
3
4
|
require 'rspec/core/deprecation'
|
@@ -39,14 +40,17 @@ module RSpec
|
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
43
|
+
# Used internally to determine what to do when a SIGINT is received
|
42
44
|
def self.wants_to_quit
|
43
45
|
world.wants_to_quit
|
44
46
|
end
|
45
47
|
|
48
|
+
# Used internally to determine what to do when a SIGINT is received
|
46
49
|
def self.wants_to_quit=(maybe)
|
47
50
|
world.wants_to_quit=(maybe)
|
48
51
|
end
|
49
52
|
|
53
|
+
# Internal container for global non-configuration data
|
50
54
|
def self.world
|
51
55
|
@world ||= RSpec::Core::World.new
|
52
56
|
end
|
@@ -58,6 +62,7 @@ module RSpec
|
|
58
62
|
configuration.reset
|
59
63
|
end
|
60
64
|
|
65
|
+
# Returns the global configuration object
|
61
66
|
def self.configuration
|
62
67
|
@configuration ||= RSpec::Core::Configuration.new
|
63
68
|
end
|
@@ -74,6 +79,7 @@ module RSpec
|
|
74
79
|
yield configuration if block_given?
|
75
80
|
end
|
76
81
|
|
82
|
+
# Used internally to clear remaining groups when fail_fast is set
|
77
83
|
def self.clear_remaining_example_groups
|
78
84
|
world.example_groups.clear
|
79
85
|
end
|
@@ -12,15 +12,15 @@ module RSpec
|
|
12
12
|
keys = options.keys
|
13
13
|
keys.unshift(:requires) if keys.delete(:requires)
|
14
14
|
keys.unshift(:libs) if keys.delete(:libs)
|
15
|
-
|
15
|
+
|
16
16
|
formatters = options[:formatters] if keys.delete(:formatters)
|
17
|
-
|
17
|
+
|
18
18
|
config.exclusion_filter.merge! options[:exclusion_filter] if keys.delete(:exclusion_filter)
|
19
|
-
|
19
|
+
|
20
20
|
keys.each do |key|
|
21
21
|
config.send("#{key}=", options[key]) if config.respond_to?("#{key}=")
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
formatters.each {|pair| config.add_formatter(*pair) } if formatters
|
25
25
|
end
|
26
26
|
|
@@ -33,12 +33,23 @@ module RSpec
|
|
33
33
|
argv << "--fail-fast" if options[:fail_fast]
|
34
34
|
argv << "--line_number" << options[:line_number] if options[:line_number]
|
35
35
|
argv << "--options" << options[:custom_options_file] if options[:custom_options_file]
|
36
|
-
|
36
|
+
if options[:full_description]
|
37
|
+
# The argument to --example is regexp-escaped before being stuffed
|
38
|
+
# into a regexp when received for the first time (see OptionParser).
|
39
|
+
# Hence, merely grabbing the source of this regexp will retain the
|
40
|
+
# backslashes, so we must remove them.
|
41
|
+
argv << "--example" << options[:full_description].source.delete('\\')
|
42
|
+
end
|
37
43
|
if options[:filter]
|
38
44
|
options[:filter].each_pair do |k, v|
|
39
45
|
argv << "--tag" << k.to_s
|
40
46
|
end
|
41
47
|
end
|
48
|
+
if options[:exclusion_filter]
|
49
|
+
options[:exclusion_filter].each_pair do |k, v|
|
50
|
+
argv << "--tag" << "~#{k.to_s}"
|
51
|
+
end
|
52
|
+
end
|
42
53
|
if options[:formatters]
|
43
54
|
options[:formatters].each do |pair|
|
44
55
|
argv << "--format" << pair[0]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module RSpec
|
2
2
|
module Core
|
3
|
-
module
|
3
|
+
module DSL
|
4
4
|
def describe(*args, &example_group_block)
|
5
5
|
RSpec::Core::ExampleGroup.describe(*args, &example_group_block).register
|
6
6
|
end
|
@@ -8,6 +8,4 @@ module RSpec
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
include RSpec::Core::ObjectExtensions
|
13
|
-
end
|
11
|
+
include RSpec::Core::DSL
|
@@ -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)}") + " " + cyan("# #{example.full_description}"))
|
53
|
+
end
|
42
54
|
end
|
43
55
|
|
44
56
|
def dump_profile
|
@@ -46,7 +58,7 @@ module RSpec
|
|
46
58
|
output.puts "\nTop #{sorted_examples.size} slowest examples:\n"
|
47
59
|
sorted_examples.each do |example|
|
48
60
|
output.puts " #{example.full_description}"
|
49
|
-
output.puts
|
61
|
+
output.puts cyan(" #{red(format_seconds(example.execution_result[:run_time]))} #{red("seconds")} #{format_caller(example.location)}")
|
50
62
|
end
|
51
63
|
end
|
52
64
|
|
@@ -63,8 +75,8 @@ module RSpec
|
|
63
75
|
output.puts "Pending:"
|
64
76
|
pending_examples.each do |pending_example|
|
65
77
|
output.puts yellow(" #{pending_example.full_description}")
|
66
|
-
output.puts
|
67
|
-
output.puts
|
78
|
+
output.puts cyan(" # #{pending_example.execution_result[:pending_message]}")
|
79
|
+
output.puts cyan(" # #{format_caller(pending_example.location)}")
|
68
80
|
end
|
69
81
|
end
|
70
82
|
end
|
@@ -83,20 +95,12 @@ module RSpec
|
|
83
95
|
color(text, "\e[1m")
|
84
96
|
end
|
85
97
|
|
86
|
-
def white(text)
|
87
|
-
color(text, "\e[37m")
|
88
|
-
end
|
89
|
-
|
90
|
-
def green(text)
|
91
|
-
color(text, "\e[32m")
|
92
|
-
end
|
93
|
-
|
94
98
|
def red(text)
|
95
99
|
color(text, "\e[31m")
|
96
100
|
end
|
97
101
|
|
98
|
-
def
|
99
|
-
color(text, "\e[
|
102
|
+
def green(text)
|
103
|
+
color(text, "\e[32m")
|
100
104
|
end
|
101
105
|
|
102
106
|
def yellow(text)
|
@@ -107,8 +111,16 @@ module RSpec
|
|
107
111
|
color(text, "\e[34m")
|
108
112
|
end
|
109
113
|
|
110
|
-
def
|
111
|
-
color(text, "\e[
|
114
|
+
def magenta(text)
|
115
|
+
color(text, "\e[35m")
|
116
|
+
end
|
117
|
+
|
118
|
+
def cyan(text)
|
119
|
+
color(text, "\e[36m")
|
120
|
+
end
|
121
|
+
|
122
|
+
def white(text)
|
123
|
+
color(text, "\e[37m")
|
112
124
|
end
|
113
125
|
|
114
126
|
def short_padding
|
@@ -131,7 +143,7 @@ module RSpec
|
|
131
143
|
|
132
144
|
def dump_backtrace(example)
|
133
145
|
format_backtrace(example.execution_result[:exception].backtrace, example).each do |backtrace_info|
|
134
|
-
output.puts
|
146
|
+
output.puts cyan("#{long_padding}# #{backtrace_info}")
|
135
147
|
end
|
136
148
|
end
|
137
149
|
|
data/lib/rspec/core/hooks.rb
CHANGED
@@ -8,7 +8,7 @@ module RSpec
|
|
8
8
|
|
9
9
|
def initialize(options, &block)
|
10
10
|
@options = options
|
11
|
-
raise "no block given for #{
|
11
|
+
raise "no block given for #{display_name}" unless block
|
12
12
|
@block = block
|
13
13
|
end
|
14
14
|
|
@@ -23,10 +23,13 @@ module RSpec
|
|
23
23
|
def call
|
24
24
|
@block.call
|
25
25
|
end
|
26
|
+
|
27
|
+
def display_name
|
28
|
+
self.class.name.split('::').last.gsub('Hook','').downcase << " hook"
|
29
|
+
end
|
26
30
|
end
|
27
31
|
|
28
32
|
class BeforeHook < Hook
|
29
|
-
TYPE = 'before'
|
30
33
|
def run_in(example_group_instance)
|
31
34
|
if example_group_instance
|
32
35
|
example_group_instance.instance_eval(&self)
|
@@ -37,7 +40,6 @@ module RSpec
|
|
37
40
|
end
|
38
41
|
|
39
42
|
class AfterHook < Hook
|
40
|
-
TYPE = 'after'
|
41
43
|
def run_in(example_group_instance)
|
42
44
|
if example_group_instance
|
43
45
|
example_group_instance.instance_eval_with_rescue(&self)
|
@@ -48,7 +50,6 @@ module RSpec
|
|
48
50
|
end
|
49
51
|
|
50
52
|
class AroundHook < Hook
|
51
|
-
TYPE = 'around'
|
52
53
|
def call(wrapped_example)
|
53
54
|
@block.call(wrapped_example)
|
54
55
|
end
|
data/lib/rspec/core/version.rb
CHANGED
@@ -14,7 +14,7 @@ describe RSpec::Core::ConfigurationOptions do
|
|
14
14
|
config_options_object(*args).options
|
15
15
|
end
|
16
16
|
|
17
|
-
it "warns when HOME env var is not set" do
|
17
|
+
it "warns when HOME env var is not set", :unless => (RUBY_PLATFORM == 'java') do
|
18
18
|
begin
|
19
19
|
orig_home = ENV.delete("HOME")
|
20
20
|
coo = RSpec::Core::ConfigurationOptions.new([])
|
@@ -41,7 +41,7 @@ describe RSpec::Core::ConfigurationOptions do
|
|
41
41
|
config.should_receive(:add_formatter).ordered
|
42
42
|
opts.configure(config)
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
it "merges the :exclusion_filter option with the default exclusion_filter" do
|
46
46
|
opts = config_options_object(*%w[--tag ~slow])
|
47
47
|
config = RSpec::Core::Configuration.new
|
@@ -223,17 +223,38 @@ describe RSpec::Core::ConfigurationOptions do
|
|
223
223
|
config_options_object(*%w[--options custom.opts]).drb_argv.should include("--options", "custom.opts")
|
224
224
|
end
|
225
225
|
|
226
|
+
context "with --example" do
|
227
|
+
it "includes --example" do
|
228
|
+
config_options_object(*%w[--example foo]).drb_argv.should include("--example", "foo")
|
229
|
+
end
|
230
|
+
|
231
|
+
it "unescapes characters which were escaped upon storing --example originally" do
|
232
|
+
config_options_object("--example", "foo\\ bar").drb_argv.should include("--example", "foo bar")
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
226
236
|
context "with tags" do
|
227
|
-
it "includes the tags" do
|
237
|
+
it "includes the inclusion tags" do
|
228
238
|
coo = config_options_object("--tag", "tag")
|
229
239
|
coo.drb_argv.should eq(["--tag", "tag"])
|
230
240
|
end
|
231
241
|
|
232
|
-
it "leaves tags intact" do
|
242
|
+
it "leaves inclusion tags intact" do
|
233
243
|
coo = config_options_object("--tag", "tag")
|
234
244
|
coo.drb_argv
|
235
245
|
coo.options[:filter].should eq( {:tag=>true} )
|
236
246
|
end
|
247
|
+
|
248
|
+
it "includes the exclusion tags" do
|
249
|
+
coo = config_options_object("--tag", "~tag")
|
250
|
+
coo.drb_argv.should eq(["--tag", "~tag"])
|
251
|
+
end
|
252
|
+
|
253
|
+
it "leaves exclusion tags intact" do
|
254
|
+
coo = config_options_object("--tag", "~tag")
|
255
|
+
coo.drb_argv
|
256
|
+
coo.options[:exclusion_filter].should eq( {:tag=>true} )
|
257
|
+
end
|
237
258
|
end
|
238
259
|
|
239
260
|
context "with formatters" do
|
@@ -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
|
@@ -312,18 +312,14 @@ a {
|
|
312
312
|
<span class="failed_spec_name">fails</span>
|
313
313
|
<div class="failure" id="failure_1">
|
314
314
|
<div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
|
315
|
-
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
<span class="linenum">25</span> <span class="keyword">end</span>
|
324
|
-
<span class="offending"><span class="linenum">26</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>
|
325
|
-
<span class="linenum">27</span> <span class="keyword">end</span>
|
326
|
-
<span class="linenum">28</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
|
315
|
+
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `(root)'
|
316
|
+
org/jruby/RubyKernel.java:2021:in `instance_eval'
|
317
|
+
org/jruby/RubyArray.java:2336:in `collect'</pre></div>
|
318
|
+
<pre class="ruby"><code><span class="linenum">29</span> <span class="ident">teardown_mocks_for_rspec</span>
|
319
|
+
<span class="linenum">30</span> <span class="keyword">end</span>
|
320
|
+
<span class="offending"><span class="linenum">31</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>
|
321
|
+
<span class="linenum">32</span> <span class="keyword">end</span>
|
322
|
+
<span class="linenum">33</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
|
327
323
|
</div>
|
328
324
|
</dd>
|
329
325
|
</dl>
|
@@ -350,13 +346,9 @@ expected 2
|
|
350
346
|
|
351
347
|
(compared using ==)
|
352
348
|
</pre></div>
|
353
|
-
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33
|
354
|
-
|
355
|
-
|
356
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `open'
|
357
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:46
|
358
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `chdir'
|
359
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:45</pre></div>
|
349
|
+
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33:in `(root)'
|
350
|
+
org/jruby/RubyKernel.java:2021:in `instance_eval'
|
351
|
+
org/jruby/RubyArray.java:2336:in `collect'</pre></div>
|
360
352
|
<pre class="ruby"><code><span class="linenum">27</span> <span class="keyword">end</span>
|
361
353
|
<span class="linenum">28</span>
|
362
354
|
<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>
|
@@ -375,7 +367,11 @@ expected 2
|
|
375
367
|
<span class="failed_spec_name">fails with a backtrace that has no file</span>
|
376
368
|
<div class="failure" id="failure_3">
|
377
369
|
<div class="message"><pre>foo</pre></div>
|
378
|
-
<div class="backtrace"><pre>(erb):1
|
370
|
+
<div class="backtrace"><pre>(erb):1:in `result'
|
371
|
+
org/jruby/RubyKernel.java:1088:in `eval'
|
372
|
+
./spec/rspec/core/resources/formatter_specs.rb:41:in `(root)'
|
373
|
+
org/jruby/RubyKernel.java:2021:in `instance_eval'
|
374
|
+
org/jruby/RubyArray.java:2336:in `collect'</pre></div>
|
379
375
|
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
|
380
376
|
</div>
|
381
377
|
</dd>
|
@@ -312,18 +312,14 @@ a {
|
|
312
312
|
<span class="failed_spec_name">fails</span>
|
313
313
|
<div class="failure" id="failure_1">
|
314
314
|
<div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
|
315
|
-
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a>
|
316
|
-
|
317
|
-
|
318
|
-
<
|
319
|
-
<
|
320
|
-
<
|
321
|
-
<
|
322
|
-
|
323
|
-
<span class="linenum">25</span> <span class="keyword">end</span>
|
324
|
-
<span class="offending"><span class="linenum">26</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>
|
325
|
-
<span class="linenum">27</span> <span class="keyword">end</span>
|
326
|
-
<span class="linenum">28</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
|
315
|
+
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `(root)'
|
316
|
+
org/jruby/RubyKernel.java:2021:in `instance_eval'
|
317
|
+
org/jruby/RubyArray.java:2336:in `collect'</pre></div>
|
318
|
+
<pre class="ruby"><code><span class="linenum">29</span> <span class="ident">teardown_mocks_for_rspec</span>
|
319
|
+
<span class="linenum">30</span> <span class="keyword">end</span>
|
320
|
+
<span class="offending"><span class="linenum">31</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>
|
321
|
+
<span class="linenum">32</span> <span class="keyword">end</span>
|
322
|
+
<span class="linenum">33</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
|
327
323
|
</div>
|
328
324
|
</dd>
|
329
325
|
</dl>
|
@@ -350,13 +346,9 @@ expected 2
|
|
350
346
|
|
351
347
|
(compared using ==)
|
352
348
|
</pre></div>
|
353
|
-
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a>
|
354
|
-
|
355
|
-
|
356
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a> :in `open'
|
357
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=47">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:47</a>
|
358
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> :in `chdir'
|
359
|
-
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=46">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:46</a> </pre></div>
|
349
|
+
<div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> :in `(root)'
|
350
|
+
org/jruby/RubyKernel.java:2021:in `instance_eval'
|
351
|
+
org/jruby/RubyArray.java:2336:in `collect'</pre></div>
|
360
352
|
<pre class="ruby"><code><span class="linenum">27</span> <span class="keyword">end</span>
|
361
353
|
<span class="linenum">28</span>
|
362
354
|
<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>
|
@@ -375,7 +367,11 @@ expected 2
|
|
375
367
|
<span class="failed_spec_name">fails with a backtrace that has no file</span>
|
376
368
|
<div class="failure" id="failure_3">
|
377
369
|
<div class="message"><pre>foo</pre></div>
|
378
|
-
<div class="backtrace"><pre>(erb):1
|
370
|
+
<div class="backtrace"><pre>(erb):1:in `result'
|
371
|
+
org/jruby/RubyKernel.java:1088:in `eval'
|
372
|
+
<a href="txmt://open?url=file:///Users/david/projects/ruby/rspec2/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=41">./spec/rspec/core/resources/formatter_specs.rb:41</a> :in `(root)'
|
373
|
+
org/jruby/RubyKernel.java:2021:in `instance_eval'
|
374
|
+
org/jruby/RubyArray.java:2336:in `collect'</pre></div>
|
379
375
|
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
|
380
376
|
</div>
|
381
377
|
</dd>
|
data/spec/spec_helper.rb
CHANGED
@@ -19,7 +19,6 @@ def sandboxed(&block)
|
|
19
19
|
RSpec.instance_variable_set(:@configuration, new_config)
|
20
20
|
RSpec.instance_variable_set(:@world, new_world)
|
21
21
|
object = Object.new
|
22
|
-
object.extend(RSpec::Core::ObjectExtensions)
|
23
22
|
object.extend(RSpec::Core::SharedExampleGroup)
|
24
23
|
|
25
24
|
(class << RSpec::Core::ExampleGroup; self; end).class_eval do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 2.6.
|
9
|
+
- 4
|
10
|
+
version: 2.6.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chad Humphries
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-06-06 00:00:00 -05:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|
@@ -34,6 +34,7 @@ files:
|
|
34
34
|
- .gitignore
|
35
35
|
- .rspec
|
36
36
|
- .travis.yml
|
37
|
+
- Changelog.md
|
37
38
|
- Gemfile
|
38
39
|
- Guardfile
|
39
40
|
- License.txt
|
@@ -44,7 +45,6 @@ files:
|
|
44
45
|
- cucumber.yml
|
45
46
|
- features/.nav
|
46
47
|
- features/Autotest.md
|
47
|
-
- features/Changelog.md
|
48
48
|
- features/README.md
|
49
49
|
- features/Upgrade.md
|
50
50
|
- features/command_line/README.md
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/rspec/core/configuration_options.rb
|
104
104
|
- lib/rspec/core/deprecation.rb
|
105
105
|
- lib/rspec/core/drb_command_line.rb
|
106
|
+
- lib/rspec/core/dsl.rb
|
106
107
|
- lib/rspec/core/errors.rb
|
107
108
|
- lib/rspec/core/example.rb
|
108
109
|
- lib/rspec/core/example_group.rb
|
@@ -112,7 +113,6 @@ files:
|
|
112
113
|
- lib/rspec/core/extensions/instance_eval_with_args.rb
|
113
114
|
- lib/rspec/core/extensions/kernel.rb
|
114
115
|
- lib/rspec/core/extensions/module_eval_with_args.rb
|
115
|
-
- lib/rspec/core/extensions/object.rb
|
116
116
|
- lib/rspec/core/formatters/base_formatter.rb
|
117
117
|
- lib/rspec/core/formatters/base_text_formatter.rb
|
118
118
|
- lib/rspec/core/formatters/documentation_formatter.rb
|
@@ -241,10 +241,9 @@ rubyforge_project: rspec
|
|
241
241
|
rubygems_version: 1.6.2
|
242
242
|
signing_key:
|
243
243
|
specification_version: 3
|
244
|
-
summary: rspec-core-2.6.
|
244
|
+
summary: rspec-core-2.6.4
|
245
245
|
test_files:
|
246
246
|
- features/Autotest.md
|
247
|
-
- features/Changelog.md
|
248
247
|
- features/README.md
|
249
248
|
- features/Upgrade.md
|
250
249
|
- features/command_line/README.md
|