rspec 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +31 -1
- data/Manifest.txt +14 -12
- data/Rakefile +1 -1
- data/Upgrade.rdoc +43 -3
- data/examples/failing/failing_implicit_docstrings_example.rb +5 -5
- data/examples/passing/implicit_docstrings_example.rb +3 -3
- data/features/before_and_after_blocks/before_and_after_blocks.feature +20 -21
- data/features/example_groups/example_group_with_should_methods.feature +20 -8
- data/features/example_groups/implicit_docstrings.feature +36 -20
- data/features/example_groups/nested_groups.feature +25 -10
- data/features/extensions/custom_example_group.feature +19 -0
- data/features/formatters/custom_formatter.feature +30 -0
- data/features/heckle/heckle.feature +7 -7
- data/features/interop/examples_and_tests_together.feature +63 -14
- data/features/interop/rspec_output.feature +25 -0
- data/features/interop/test_but_not_test_unit.feature +19 -7
- data/features/interop/test_case_with_should_methods.feature +37 -8
- data/features/matchers/{create_matcher.feature → define_matcher.feature} +54 -30
- data/features/matchers/{create_matcher_outside_rspec.feature → define_matcher_outside_rspec.feature} +7 -7
- data/features/mock_framework_integration/use_flexmock.feature +3 -3
- data/features/mock_framework_integration/use_mocha.feature +3 -3
- data/features/mock_framework_integration/use_rr.feature +3 -3
- data/features/mocks/mix_stubs_and_mocks.feature +4 -4
- data/features/pending/pending_examples.feature +18 -18
- data/features/runner/specify_line_number.feature +32 -0
- data/features/step_definitions/running_rspec_steps.rb +41 -0
- data/features/subject/explicit_subject.feature +4 -4
- data/features/subject/implicit_subject.feature +4 -4
- data/features/support/env.rb +64 -11
- data/features/support/matchers/smart_match.rb +10 -35
- data/lib/spec.rb +1 -0
- data/lib/spec/deprecation.rb +40 -0
- data/lib/spec/dsl/main.rb +10 -5
- data/lib/spec/example.rb +1 -27
- data/lib/spec/example/args_and_options.rb +27 -0
- data/lib/spec/example/before_and_after_hooks.rb +30 -21
- data/lib/spec/example/errors.rb +8 -18
- data/lib/spec/example/example_group_factory.rb +0 -4
- data/lib/spec/example/example_group_methods.rb +27 -41
- data/lib/spec/example/example_group_proxy.rb +12 -22
- data/lib/spec/example/example_methods.rb +8 -18
- data/lib/spec/example/example_proxy.rb +4 -4
- data/lib/spec/example/pending.rb +3 -4
- data/lib/spec/example/predicate_matchers.rb +1 -1
- data/lib/spec/example/subject.rb +2 -0
- data/lib/spec/expectations.rb +1 -26
- data/lib/spec/expectations/extensions.rb +1 -1
- data/lib/spec/expectations/extensions/kernel.rb +52 -0
- data/lib/spec/expectations/handler.rb +21 -10
- data/lib/spec/matchers/be.rb +3 -3
- data/lib/spec/matchers/be_close.rb +17 -21
- data/lib/spec/matchers/be_instance_of.rb +7 -26
- data/lib/spec/matchers/be_kind_of.rb +7 -26
- data/lib/spec/matchers/dsl.rb +9 -4
- data/lib/spec/matchers/eql.rb +24 -25
- data/lib/spec/matchers/equal.rb +25 -25
- data/lib/spec/matchers/exist.rb +5 -21
- data/lib/spec/matchers/include.rb +22 -44
- data/lib/spec/matchers/match.rb +5 -25
- data/lib/spec/matchers/match_array.rb +8 -4
- data/lib/spec/matchers/matcher.rb +13 -2
- data/lib/spec/matchers/pretty.rb +1 -0
- data/lib/spec/matchers/simple_matcher.rb +2 -2
- data/lib/spec/mocks/mock.rb +10 -10
- data/lib/spec/mocks/spec_methods.rb +1 -1
- data/lib/spec/runner/configuration.rb +53 -42
- data/lib/spec/{expectations → runner}/differs/default.rb +0 -0
- data/lib/spec/{expectations → runner}/differs/load-diff-lcs.rb +0 -0
- data/lib/spec/runner/drb_command_line.rb +1 -1
- data/lib/spec/runner/example_group_runner.rb +0 -12
- data/lib/spec/runner/formatter/base_formatter.rb +77 -30
- data/lib/spec/runner/formatter/base_text_formatter.rb +19 -24
- data/lib/spec/runner/formatter/failing_example_groups_formatter.rb +1 -1
- data/lib/spec/runner/formatter/html_formatter.rb +4 -6
- data/lib/spec/runner/formatter/nested_text_formatter.rb +2 -2
- data/lib/spec/runner/formatter/no_op_method_missing.rb +21 -0
- data/lib/spec/runner/formatter/profile_formatter.rb +0 -4
- data/lib/spec/runner/formatter/progress_bar_formatter.rb +4 -5
- data/lib/spec/runner/formatter/silent_formatter.rb +10 -0
- data/lib/spec/runner/formatter/specdoc_formatter.rb +2 -2
- data/lib/spec/runner/option_parser.rb +14 -7
- data/lib/spec/runner/options.rb +17 -7
- data/lib/spec/runner/reporter.rb +69 -64
- data/lib/spec/version.rb +1 -1
- data/spec/spec/dsl/main_spec.rb +7 -0
- data/spec/spec/example/example_group_methods_spec.rb +16 -32
- data/spec/spec/example/example_group_proxy_spec.rb +25 -5
- data/spec/spec/example/example_group_spec.rb +2 -2
- data/spec/spec/example/example_methods_spec.rb +19 -24
- data/spec/spec/example/example_proxy_spec.rb +11 -1
- data/spec/spec/example/pending_module_spec.rb +2 -108
- data/spec/spec/example/predicate_matcher_spec.rb +23 -3
- data/spec/spec/expectations/extensions/object_spec.rb +9 -9
- data/spec/spec/expectations/fail_with_spec.rb +13 -13
- data/spec/spec/expectations/handler_spec.rb +44 -15
- data/spec/spec/matchers/be_close_spec.rb +9 -0
- data/spec/spec/matchers/be_instance_of_spec.rb +6 -4
- data/spec/spec/matchers/be_kind_of_spec.rb +5 -3
- data/spec/spec/matchers/be_spec.rb +1 -5
- data/spec/spec/matchers/compatibility_spec.rb +1 -1
- data/spec/spec/matchers/dsl_spec.rb +10 -1
- data/spec/spec/matchers/eql_spec.rb +8 -4
- data/spec/spec/matchers/equal_spec.rb +8 -4
- data/spec/spec/matchers/exist_spec.rb +1 -1
- data/spec/spec/matchers/include_spec.rb +1 -1
- data/spec/spec/matchers/match_array_spec.rb +26 -1
- data/spec/spec/matchers/match_spec.rb +2 -2
- data/spec/spec/matchers/matcher_methods_spec.rb +0 -3
- data/spec/spec/matchers/matcher_spec.rb +53 -0
- data/spec/spec/matchers/operator_matcher_spec.rb +1 -1
- data/spec/spec/mocks/mock_spec.rb +6 -0
- data/spec/spec/runner/configuration_spec.rb +11 -1
- data/spec/spec/runner/drb_command_line_spec.rb +13 -1
- data/spec/spec/runner/example_group_runner_spec.rb +0 -7
- data/spec/spec/runner/formatter/base_formatter_spec.rb +19 -12
- data/spec/spec/runner/formatter/base_text_formatter_spec.rb +2 -2
- data/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +4 -4
- data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +2 -2
- data/spec/spec/runner/formatter/html_formatted-1.8.6.html +31 -34
- data/spec/spec/runner/formatter/html_formatter_spec.rb +20 -0
- data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +20 -20
- data/spec/spec/runner/formatter/profile_formatter_spec.rb +22 -3
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +24 -3
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +6 -6
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +25 -28
- data/spec/spec/runner/formatter/text_mate_formatter_spec.rb +2 -2
- data/spec/spec/runner/option_parser_spec.rb +108 -40
- data/spec/spec/runner/reporter_spec.rb +16 -17
- data/spec/spec_helper.rb +4 -1
- metadata +20 -18
- data/features/example_groups/output.feature +0 -20
- data/features/step_definitions/running_rspec.rb +0 -69
- data/lib/spec/expectations/extensions/object.rb +0 -63
- data/resources/spec/example_group_with_should_methods.rb +0 -12
- data/resources/spec/simple_spec.rb +0 -8
- data/resources/test/spec_and_test_together.rb +0 -56
- data/resources/test/spec_including_test_but_not_unit.rb +0 -11
- data/resources/test/test_case_with_should_methods.rb +0 -29
@@ -9,7 +9,7 @@ module Spec
|
|
9
9
|
@last_nested_descriptions = []
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def example_group_started(example_group)
|
13
13
|
super
|
14
14
|
|
15
15
|
example_group.nested_descriptions.each_with_index do |nested_description, i|
|
@@ -32,7 +32,7 @@ module Spec
|
|
32
32
|
output.flush
|
33
33
|
end
|
34
34
|
|
35
|
-
def example_pending(example, message,
|
35
|
+
def example_pending(example, message, deprecated_pending_location=nil)
|
36
36
|
super
|
37
37
|
output.puts yellow("#{current_indentation}#{example.description} (PENDING: #{message})")
|
38
38
|
output.flush
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Spec
|
2
|
+
module Runner
|
3
|
+
module Formatter
|
4
|
+
module NOOPMethodMissing
|
5
|
+
def respond_to?(message, include_private = false)
|
6
|
+
if include_private
|
7
|
+
true
|
8
|
+
else
|
9
|
+
!private_methods.include?(message.to_s)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def method_missing(sym, *args)
|
16
|
+
# a no-op
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
require 'spec/runner/formatter/base_text_formatter'
|
2
|
+
require 'spec/runner/formatter/no_op_method_missing'
|
2
3
|
|
3
4
|
module Spec
|
4
5
|
module Runner
|
5
6
|
module Formatter
|
6
7
|
class ProgressBarFormatter < BaseTextFormatter
|
8
|
+
include NOOPMethodMissing
|
9
|
+
|
7
10
|
def example_failed(example, counter, failure)
|
8
11
|
@output.print colorize_failure('F', failure)
|
9
12
|
@output.flush
|
@@ -14,7 +17,7 @@ module Spec
|
|
14
17
|
@output.flush
|
15
18
|
end
|
16
19
|
|
17
|
-
def example_pending(example, message,
|
20
|
+
def example_pending(example, message, deprecated_pending_location=nil)
|
18
21
|
super
|
19
22
|
@output.print yellow('*')
|
20
23
|
@output.flush
|
@@ -24,10 +27,6 @@ module Spec
|
|
24
27
|
@output.puts
|
25
28
|
@output.flush
|
26
29
|
end
|
27
|
-
|
28
|
-
def method_missing(sym, *args)
|
29
|
-
# ignore
|
30
|
-
end
|
31
30
|
end
|
32
31
|
end
|
33
32
|
end
|
@@ -4,7 +4,7 @@ module Spec
|
|
4
4
|
module Runner
|
5
5
|
module Formatter
|
6
6
|
class SpecdocFormatter < BaseTextFormatter
|
7
|
-
def
|
7
|
+
def example_group_started(example_group)
|
8
8
|
super
|
9
9
|
output.puts
|
10
10
|
output.puts example_group.description
|
@@ -22,7 +22,7 @@ module Spec
|
|
22
22
|
output.flush
|
23
23
|
end
|
24
24
|
|
25
|
-
def example_pending(example, message,
|
25
|
+
def example_pending(example, message, deprecated_pending_location=nil)
|
26
26
|
super
|
27
27
|
output.puts yellow("- #{example.description} (PENDING: #{message})")
|
28
28
|
output.flush
|
@@ -31,7 +31,7 @@ module Spec
|
|
31
31
|
:example => ["-e", "--example [NAME|FILE_NAME]", "Execute example(s) with matching name(s). If the argument is",
|
32
32
|
"the path to an existing file (typically generated by a previous",
|
33
33
|
"run using --format failing_examples:file.txt), then the examples",
|
34
|
-
"on each line of
|
34
|
+
"on each line of that file will be executed. If the file is empty,",
|
35
35
|
"all examples will be run (as if --example was not specified).",
|
36
36
|
" ",
|
37
37
|
"If the argument is not an existing file, then it is treated as",
|
@@ -92,7 +92,7 @@ module Spec
|
|
92
92
|
|
93
93
|
@file_factory = File
|
94
94
|
|
95
|
-
self.banner = "Usage: spec (FILE
|
95
|
+
self.banner = "Usage: spec (FILE(:LINE)?|DIRECTORY|GLOB)+ [options]"
|
96
96
|
self.separator ""
|
97
97
|
on(*OPTIONS[:pattern]) {|pattern| @options.filename_pattern = pattern}
|
98
98
|
on(*OPTIONS[:diff]) {|diff| @options.parse_diff(diff)}
|
@@ -130,6 +130,11 @@ module Spec
|
|
130
130
|
return if parse_drb
|
131
131
|
|
132
132
|
super(@argv) do |file|
|
133
|
+
if file =~ /^(.+):(\d+)$/
|
134
|
+
file = $1
|
135
|
+
@options.line_number = $2.to_i
|
136
|
+
end
|
137
|
+
|
133
138
|
@options.files << file
|
134
139
|
blk.call(file) if blk
|
135
140
|
end
|
@@ -185,11 +190,13 @@ module Spec
|
|
185
190
|
is_drb ||= argv.delete(OPTIONS[:drb][0])
|
186
191
|
is_drb ||= argv.delete(OPTIONS[:drb][1])
|
187
192
|
return false unless is_drb
|
188
|
-
@
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
+
if DrbCommandLine.run(self.class.parse(argv, @error_stream, @out_stream))
|
194
|
+
@options.examples_should_not_be_run
|
195
|
+
true
|
196
|
+
else
|
197
|
+
@error_stream.puts "Running specs locally:"
|
198
|
+
false
|
199
|
+
end
|
193
200
|
end
|
194
201
|
|
195
202
|
def parse_version
|
data/lib/spec/runner/options.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
1
3
|
module Spec
|
2
4
|
module Runner
|
3
5
|
class Options
|
@@ -6,8 +8,8 @@ module Spec
|
|
6
8
|
}
|
7
9
|
|
8
10
|
EXAMPLE_FORMATTERS = { # Load these lazily for better speed
|
9
|
-
'silent' => ['spec/runner/formatter/
|
10
|
-
'l' => ['spec/runner/formatter/
|
11
|
+
'silent' => ['spec/runner/formatter/silent_formatter', 'Formatter::SilentFormatter'],
|
12
|
+
'l' => ['spec/runner/formatter/silent_formatter', 'Formatter::SilentFormatter'],
|
11
13
|
'specdoc' => ['spec/runner/formatter/specdoc_formatter', 'Formatter::SpecdocFormatter'],
|
12
14
|
's' => ['spec/runner/formatter/specdoc_formatter', 'Formatter::SpecdocFormatter'],
|
13
15
|
'nested' => ['spec/runner/formatter/nested_text_formatter', 'Formatter::NestedTextFormatter'],
|
@@ -208,9 +210,17 @@ module Spec
|
|
208
210
|
else
|
209
211
|
load_class(format, 'formatter', '--format')
|
210
212
|
end
|
211
|
-
formatter_type.new(
|
213
|
+
formatter_type.new(formatter_options, where)
|
212
214
|
end
|
213
215
|
end
|
216
|
+
|
217
|
+
def formatter_options
|
218
|
+
@formatter_options ||= OpenStruct.new(
|
219
|
+
:colour => colour,
|
220
|
+
:autospec => autospec,
|
221
|
+
:dry_run => dry_run
|
222
|
+
)
|
223
|
+
end
|
214
224
|
|
215
225
|
def load_heckle_runner(heckle)
|
216
226
|
@format_options ||= [['silent', @output_stream]]
|
@@ -319,7 +329,7 @@ module Spec
|
|
319
329
|
end
|
320
330
|
|
321
331
|
def default_differ
|
322
|
-
require 'spec/
|
332
|
+
require 'spec/runner/differs/default'
|
323
333
|
self.differ_class = ::Spec::Expectations::Differs::Default
|
324
334
|
end
|
325
335
|
|
@@ -327,18 +337,18 @@ module Spec
|
|
327
337
|
if examples.empty?
|
328
338
|
if files.length == 1
|
329
339
|
if File.directory?(files[0])
|
330
|
-
error_stream.puts "You must specify one file, not a directory when
|
340
|
+
error_stream.puts "You must specify one file, not a directory when providing a line number"
|
331
341
|
exit(1) if stderr?
|
332
342
|
else
|
333
343
|
example = SpecParser.new(self).spec_name_for(files[0], line_number)
|
334
344
|
@examples = [example]
|
335
345
|
end
|
336
346
|
else
|
337
|
-
error_stream.puts "Only one file can be specified when
|
347
|
+
error_stream.puts "Only one file can be specified when providing a line number: #{files.inspect}"
|
338
348
|
exit(3) if stderr?
|
339
349
|
end
|
340
350
|
else
|
341
|
-
error_stream.puts "You cannot use
|
351
|
+
error_stream.puts "You cannot use --example and specify a line number"
|
342
352
|
exit(4) if stderr?
|
343
353
|
end
|
344
354
|
end
|
data/lib/spec/runner/reporter.rb
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
module Spec
|
2
2
|
module Runner
|
3
3
|
class Reporter
|
4
|
-
attr_reader :options
|
4
|
+
attr_reader :options
|
5
5
|
|
6
6
|
def initialize(options)
|
7
7
|
@options = options
|
8
8
|
@options.reporter = self
|
9
|
-
|
9
|
+
@failures = []
|
10
|
+
@pending_count = 0
|
11
|
+
@example_count = 0
|
12
|
+
@start_time = nil
|
13
|
+
@end_time = nil
|
10
14
|
end
|
11
15
|
|
12
|
-
def
|
16
|
+
def example_group_started(example_group)
|
17
|
+
@example_group = example_group
|
13
18
|
formatters.each do |f|
|
14
|
-
f.
|
19
|
+
f.example_group_started(example_group)
|
15
20
|
end
|
16
|
-
example_groups << example_group
|
17
21
|
end
|
18
22
|
|
19
23
|
def example_started(example)
|
@@ -21,12 +25,12 @@ module Spec
|
|
21
25
|
end
|
22
26
|
|
23
27
|
def example_finished(example, error=nil)
|
24
|
-
@
|
28
|
+
@example_count += 1
|
25
29
|
|
26
30
|
if error.nil?
|
27
31
|
example_passed(example)
|
28
32
|
elsif Spec::Example::ExamplePendingError === error
|
29
|
-
example_pending(example,
|
33
|
+
example_pending(example, example.location, error.message)
|
30
34
|
else
|
31
35
|
example_failed(example, error)
|
32
36
|
end
|
@@ -34,7 +38,7 @@ module Spec
|
|
34
38
|
|
35
39
|
def example_failed(example, error)
|
36
40
|
backtrace_tweaker.tweak_backtrace(error)
|
37
|
-
failure = Failure.new(
|
41
|
+
failure = Failure.new(@example_group.description, example.description, error)
|
38
42
|
@failures << failure
|
39
43
|
formatters.each do |f|
|
40
44
|
f.example_failed(example, @failures.length, failure)
|
@@ -42,7 +46,6 @@ module Spec
|
|
42
46
|
end
|
43
47
|
|
44
48
|
def start(number_of_examples)
|
45
|
-
clear
|
46
49
|
@start_time = Time.new
|
47
50
|
formatters.each{|f| f.start(number_of_examples)}
|
48
51
|
end
|
@@ -57,12 +60,51 @@ module Spec
|
|
57
60
|
dump_pending
|
58
61
|
dump_failures
|
59
62
|
formatters.each do |f|
|
60
|
-
f.dump_summary(duration, @
|
63
|
+
f.dump_summary(duration, @example_count, @failures.length, @pending_count)
|
61
64
|
f.close
|
62
65
|
end
|
63
66
|
@failures.length
|
64
67
|
end
|
65
68
|
|
69
|
+
class Failure
|
70
|
+
def initialize(group_description, example_description, exception) # :nodoc:
|
71
|
+
@example_name = "#{group_description} #{example_description}"
|
72
|
+
@exception = exception
|
73
|
+
end
|
74
|
+
|
75
|
+
# The Exception object raised
|
76
|
+
attr_reader :exception
|
77
|
+
|
78
|
+
# Header messsage for reporting this failure, including the name of the
|
79
|
+
# example and an indicator of the type of failure. FAILED indicates a
|
80
|
+
# failed expectation. FIXED indicates a pending example that passes, and
|
81
|
+
# no longer needs to be pending. RuntimeError indicates that a
|
82
|
+
# RuntimeError occured.
|
83
|
+
#
|
84
|
+
# == Examples
|
85
|
+
#
|
86
|
+
# 'A new account should have a zero balance' FAILED
|
87
|
+
# 'A new account should have a zero balance' FIXED
|
88
|
+
# RuntimeError in 'A new account should have a zero balance'
|
89
|
+
def header
|
90
|
+
if expectation_not_met?
|
91
|
+
"'#{@example_name}' FAILED"
|
92
|
+
elsif pending_fixed?
|
93
|
+
"'#{@example_name}' FIXED"
|
94
|
+
else
|
95
|
+
"#{@exception.class.name} in '#{@example_name}'"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def pending_fixed? # :nodoc:
|
100
|
+
@exception.is_a?(Spec::Example::PendingExampleFixedError)
|
101
|
+
end
|
102
|
+
|
103
|
+
def expectation_not_met? # :nodoc:
|
104
|
+
@exception.is_a?(Spec::Expectations::ExpectationNotMetError)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
66
108
|
private
|
67
109
|
|
68
110
|
def formatters
|
@@ -73,15 +115,6 @@ module Spec
|
|
73
115
|
@options.backtrace_tweaker
|
74
116
|
end
|
75
117
|
|
76
|
-
def clear
|
77
|
-
@example_groups = []
|
78
|
-
@failures = []
|
79
|
-
@pending_count = 0
|
80
|
-
@examples = []
|
81
|
-
@start_time = nil
|
82
|
-
@end_time = nil
|
83
|
-
end
|
84
|
-
|
85
118
|
def dump_failures
|
86
119
|
return if @failures.empty?
|
87
120
|
@failures.inject(1) do |index, failure|
|
@@ -104,63 +137,35 @@ module Spec
|
|
104
137
|
end
|
105
138
|
|
106
139
|
EXAMPLE_PENDING_DEPRECATION_WARNING = <<-WARNING
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
140
|
+
|
141
|
+
*********************************************************************
|
142
|
+
DEPRECATION WARNING: RSpec's formatters have changed example_pending
|
143
|
+
to accept two arguments instead of three. Please see the rdoc
|
144
|
+
for Spec::Runner::Formatter::BaseFormatter#example_pending
|
145
|
+
for more information.
|
146
|
+
|
147
|
+
Please update any custom formatters to accept only two arguments
|
148
|
+
to example_pending. Support for example_pending with two arguments
|
149
|
+
and this warning message will be removed after the RSpec 2.0 release.
|
150
|
+
*********************************************************************
|
151
|
+
WARNING
|
116
152
|
|
117
|
-
def example_pending(example,
|
153
|
+
def example_pending(example, ignore, message="Not Yet Implemented")
|
118
154
|
@pending_count += 1
|
119
155
|
formatters.each do |formatter|
|
120
156
|
if formatter_uses_deprecated_example_pending_method?(formatter)
|
121
|
-
|
122
|
-
formatter.example_pending(example, message)
|
157
|
+
Spec.warn EXAMPLE_PENDING_DEPRECATION_WARNING
|
158
|
+
formatter.example_pending(example, message, example.location)
|
123
159
|
else
|
124
|
-
formatter.example_pending(example, message
|
160
|
+
formatter.example_pending(example, message)
|
125
161
|
end
|
126
162
|
end
|
127
163
|
end
|
128
164
|
|
129
165
|
def formatter_uses_deprecated_example_pending_method?(formatter)
|
130
|
-
formatter.method(:example_pending).arity ==
|
166
|
+
formatter.method(:example_pending).arity == 3
|
131
167
|
end
|
132
168
|
|
133
|
-
class Failure
|
134
|
-
attr_reader :example, :exception
|
135
|
-
|
136
|
-
def initialize(group, example, exception)
|
137
|
-
@group, @example, @exception = group, example, exception
|
138
|
-
end
|
139
|
-
|
140
|
-
def header
|
141
|
-
if expectation_not_met?
|
142
|
-
"'#{example_name}' FAILED"
|
143
|
-
elsif pending_fixed?
|
144
|
-
"'#{example_name}' FIXED"
|
145
|
-
else
|
146
|
-
"#{@exception.class.name} in '#{example_name}'"
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
def pending_fixed?
|
151
|
-
@exception.is_a?(Spec::Example::PendingExampleFixedError)
|
152
|
-
end
|
153
|
-
|
154
|
-
def expectation_not_met?
|
155
|
-
@exception.is_a?(Spec::Expectations::ExpectationNotMetError)
|
156
|
-
end
|
157
|
-
|
158
|
-
protected
|
159
|
-
|
160
|
-
def example_name
|
161
|
-
"#{@group} #{@example.description}"
|
162
|
-
end
|
163
|
-
end
|
164
169
|
end
|
165
170
|
end
|
166
171
|
end
|
data/lib/spec/version.rb
CHANGED
data/spec/spec/dsl/main_spec.rb
CHANGED
@@ -16,6 +16,13 @@ module Spec
|
|
16
16
|
)
|
17
17
|
@main.__send__ method, "The ExampleGroup", &block
|
18
18
|
end
|
19
|
+
|
20
|
+
it "raises with no description" do
|
21
|
+
block = lambda {|a,b|}
|
22
|
+
lambda do
|
23
|
+
@main.__send__ method, &block
|
24
|
+
end.should raise_error(ArgumentError, /No description supplied for example group declared on #{__FILE__}:#{__LINE__ - 1}/)
|
25
|
+
end
|
19
26
|
end
|
20
27
|
end
|
21
28
|
|