rspec 1.2.0 → 1.2.1
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/.document +4 -4
- data/{History.txt → History.rdoc} +27 -4
- data/Manifest.txt +18 -7
- data/{README.txt → README.rdoc} +0 -0
- data/Rakefile +16 -9
- data/{Ruby1.9.markdown → Ruby1.9.rdoc} +3 -3
- data/TODO.txt +0 -7
- data/Upgrade.rdoc +110 -0
- data/features/matchers/create_matcher.feature +40 -0
- data/features/matchers/create_matcher_outside_rspec.feature +39 -0
- data/features/pending/pending_examples.feature +5 -5
- data/features/step_definitions/running_rspec.rb +13 -0
- data/features/subject/explicit_subject.feature +31 -0
- data/features/subject/implicit_subject.feature +31 -0
- data/lib/spec/adapters/mock_frameworks/flexmock.rb +1 -0
- data/lib/spec/adapters/mock_frameworks/mocha.rb +1 -0
- data/lib/spec/adapters/mock_frameworks/rr.rb +1 -0
- data/lib/spec/adapters/mock_frameworks/rspec.rb +12 -10
- data/lib/spec/dsl.rb +0 -1
- data/lib/spec/dsl/main.rb +3 -3
- data/lib/spec/example.rb +4 -3
- data/lib/spec/example/example_group_factory.rb +1 -3
- data/lib/spec/example/example_group_methods.rb +22 -28
- data/lib/spec/example/example_group_proxy.rb +64 -0
- data/lib/spec/example/example_methods.rb +8 -11
- data/lib/spec/example/example_proxy.rb +42 -0
- data/lib/spec/example/shared_example_group.rb +1 -1
- data/lib/spec/example/subject.rb +14 -3
- data/lib/spec/expectations.rb +1 -1
- data/lib/spec/expectations/differs/default.rb +46 -49
- data/lib/spec/expectations/differs/load-diff-lcs.rb +12 -0
- data/lib/spec/interop/test/unit/testcase.rb +2 -2
- data/lib/spec/matchers.rb +49 -9
- data/lib/spec/matchers/be.rb +12 -15
- data/lib/spec/matchers/change.rb +1 -0
- data/lib/spec/matchers/dsl.rb +15 -0
- data/lib/spec/matchers/have.rb +9 -8
- data/lib/spec/matchers/include.rb +2 -16
- data/lib/spec/matchers/match_array.rb +2 -14
- data/lib/spec/matchers/matcher.rb +16 -11
- data/lib/spec/matchers/pretty.rb +36 -0
- data/lib/spec/matchers/raise_error.rb +9 -8
- data/lib/spec/matchers/simple_matcher.rb +1 -0
- data/lib/spec/matchers/throw_symbol.rb +1 -1
- data/lib/spec/mocks/argument_expectation.rb +2 -0
- data/lib/spec/mocks/message_expectation.rb +2 -0
- data/lib/spec/mocks/proxy.rb +9 -10
- data/lib/spec/runner.rb +1 -0
- data/lib/spec/runner/extensions/kernel.rb +9 -0
- data/lib/spec/runner/formatter/base_formatter.rb +22 -9
- data/lib/spec/runner/formatter/html_formatter.rb +2 -1
- data/lib/spec/runner/heckle_runner.rb +1 -0
- data/lib/spec/runner/option_parser.rb +4 -1
- data/lib/spec/runner/options.rb +11 -0
- data/lib/spec/runner/spec_parser.rb +15 -22
- data/lib/spec/version.rb +4 -6
- data/spec/autotest/autotest_helper.rb +6 -1
- data/spec/spec/dsl/main_spec.rb +3 -3
- data/spec/spec/example/example_group_factory_spec.rb +11 -23
- data/spec/spec/example/example_group_methods_spec.rb +45 -20
- data/spec/spec/example/example_group_proxy_spec.rb +63 -0
- data/spec/spec/example/example_group_spec.rb +15 -0
- data/spec/spec/example/example_methods_spec.rb +5 -35
- data/spec/spec/example/example_proxy_spec.rb +47 -0
- data/spec/spec/example/nested_example_group_spec.rb +3 -3
- data/spec/spec/example/shared_example_group_spec.rb +4 -4
- data/spec/spec/example/subject_spec.rb +77 -0
- data/spec/spec/matchers/be_close_spec.rb +10 -10
- data/spec/spec/matchers/be_instance_of_spec.rb +13 -8
- data/spec/spec/matchers/be_kind_of_spec.rb +10 -8
- data/spec/spec/{dsl/matchers_spec.rb → matchers/dsl_spec.rb} +4 -4
- data/spec/spec/matchers/matcher_spec.rb +53 -1
- data/spec/spec/matchers/matchers_spec.rb +2 -0
- data/spec/spec/package/bin_spec_spec.rb +4 -4
- data/spec/spec/runner/command_line_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.4.html +1 -1
- data/spec/spec/runner/formatter/html_formatted-1.8.5-jruby.html +1 -1
- data/spec/spec/runner/formatter/html_formatted-1.8.5.html +1 -1
- data/spec/spec/runner/formatter/html_formatted-1.8.6-jruby.html +1 -1
- data/spec/spec/runner/formatter/html_formatted-1.8.6.html +1 -1
- data/spec/spec/runner/formatter/html_formatted-1.8.7.html +1 -1
- data/spec/spec/runner/formatter/html_formatted-1.9.1.html +1 -1
- data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +12 -11
- data/spec/spec/runner/formatter/profile_formatter_spec.rb +2 -2
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +2 -2
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +2 -2
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.4.html +1 -1
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +1 -1
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.7.html +1 -1
- data/spec/spec/runner/formatter/text_mate_formatted-1.9.1.html +1 -1
- data/spec/spec/runner/option_parser_spec.rb +20 -0
- data/spec/spec/runner/options_spec.rb +23 -1
- data/spec/spec/runner/reporter_spec.rb +20 -17
- data/spec/spec/runner/spec_parser_spec.rb +1 -1
- metadata +33 -15
- data/Upgrade.markdown +0 -63
- data/lib/spec/dsl/matchers.rb +0 -13
- data/lib/spec/example/example_description.rb +0 -15
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Spec
|
|
2
|
+
module Matchers
|
|
3
|
+
module DSL
|
|
4
|
+
def create(name, &block_passed_to_create)
|
|
5
|
+
define_method name do |*expected|
|
|
6
|
+
Spec::Matchers::Matcher.new name, *expected, &block_passed_to_create
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Spec::Matchers.extend Spec::Matchers::DSL
|
|
14
|
+
|
|
15
|
+
|
data/lib/spec/matchers/have.rb
CHANGED
|
@@ -4,6 +4,7 @@ module Spec
|
|
|
4
4
|
def initialize(expected, relativity=:exactly)
|
|
5
5
|
@expected = (expected == :no ? 0 : expected)
|
|
6
6
|
@relativity = relativity
|
|
7
|
+
@actual = nil
|
|
7
8
|
end
|
|
8
9
|
|
|
9
10
|
def relativities
|
|
@@ -24,12 +25,12 @@ module Spec
|
|
|
24
25
|
else
|
|
25
26
|
collection_owner.__send__(@collection_name, *@args, &@block)
|
|
26
27
|
end
|
|
27
|
-
@
|
|
28
|
-
@
|
|
29
|
-
raise not_a_collection if @
|
|
30
|
-
return @
|
|
31
|
-
return @
|
|
32
|
-
return @
|
|
28
|
+
@actual = collection.size if collection.respond_to?(:size)
|
|
29
|
+
@actual = collection.length if collection.respond_to?(:length)
|
|
30
|
+
raise not_a_collection if @actual.nil?
|
|
31
|
+
return @actual >= @expected if @relativity == :at_least
|
|
32
|
+
return @actual <= @expected if @relativity == :at_most
|
|
33
|
+
return @actual == @expected
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
def not_a_collection
|
|
@@ -37,12 +38,12 @@ module Spec
|
|
|
37
38
|
end
|
|
38
39
|
|
|
39
40
|
def failure_message_for_should
|
|
40
|
-
"expected #{relative_expectation} #{@collection_name}, got #{@
|
|
41
|
+
"expected #{relative_expectation} #{@collection_name}, got #{@actual}"
|
|
41
42
|
end
|
|
42
43
|
|
|
43
44
|
def failure_message_for_should_not
|
|
44
45
|
if @relativity == :exactly
|
|
45
|
-
return "expected target not to have #{@expected} #{@collection_name}, got #{@
|
|
46
|
+
return "expected target not to have #{@expected} #{@collection_name}, got #{@actual}"
|
|
46
47
|
elsif @relativity == :at_most
|
|
47
48
|
return <<-EOF
|
|
48
49
|
Isn't life confusing enough?
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
module Spec
|
|
2
2
|
module Matchers
|
|
3
|
-
|
|
4
3
|
class Include #:nodoc:
|
|
5
|
-
|
|
4
|
+
include Spec::Matchers::Pretty
|
|
5
|
+
|
|
6
6
|
def initialize(*expecteds)
|
|
7
7
|
@expecteds = expecteds
|
|
8
8
|
end
|
|
@@ -41,20 +41,6 @@ module Spec
|
|
|
41
41
|
def _message(maybe_not="")
|
|
42
42
|
"expected #{@actual.inspect} #{maybe_not}to include #{_pretty_print(@expecteds)}"
|
|
43
43
|
end
|
|
44
|
-
|
|
45
|
-
def _pretty_print(array)
|
|
46
|
-
result = ""
|
|
47
|
-
array.each_with_index do |item, index|
|
|
48
|
-
if index < (array.length - 2)
|
|
49
|
-
result << "#{item.inspect}, "
|
|
50
|
-
elsif index < (array.length - 1)
|
|
51
|
-
result << "#{item.inspect} and "
|
|
52
|
-
else
|
|
53
|
-
result << "#{item.inspect}"
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
result
|
|
57
|
-
end
|
|
58
44
|
end
|
|
59
45
|
|
|
60
46
|
# :call-seq:
|
|
@@ -2,7 +2,8 @@ module Spec
|
|
|
2
2
|
module Matchers
|
|
3
3
|
|
|
4
4
|
class MatchArray #:nodoc:
|
|
5
|
-
|
|
5
|
+
include Spec::Matchers::Pretty
|
|
6
|
+
|
|
6
7
|
def initialize(expected)
|
|
7
8
|
@expected = expected
|
|
8
9
|
end
|
|
@@ -42,19 +43,6 @@ module Spec
|
|
|
42
43
|
difference
|
|
43
44
|
end
|
|
44
45
|
|
|
45
|
-
def _pretty_print(array)
|
|
46
|
-
result = ""
|
|
47
|
-
array.each_with_index do |item, index|
|
|
48
|
-
if index < (array.length - 2)
|
|
49
|
-
result << "#{item.inspect}, "
|
|
50
|
-
elsif index < (array.length - 1)
|
|
51
|
-
result << "#{item.inspect} and "
|
|
52
|
-
else
|
|
53
|
-
result << "#{item.inspect}"
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
result
|
|
57
|
-
end
|
|
58
46
|
|
|
59
47
|
end
|
|
60
48
|
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
module Spec
|
|
2
2
|
module Matchers
|
|
3
3
|
class Matcher
|
|
4
|
-
|
|
4
|
+
include Spec::Matchers::Pretty
|
|
5
|
+
|
|
6
|
+
def initialize(name, *expected, &declarations)
|
|
5
7
|
@name = name
|
|
6
8
|
@expected = expected
|
|
7
|
-
@
|
|
9
|
+
@declarations = declarations
|
|
8
10
|
@messages = {
|
|
9
|
-
:description => lambda {"#{name_to_sentence}
|
|
10
|
-
:failure_message_for_should => lambda {|actual| "expected #{actual} to #{name_to_sentence}
|
|
11
|
-
:failure_message_for_should_not => lambda {|actual| "expected #{actual} not to #{name_to_sentence}
|
|
11
|
+
:description => lambda {"#{name_to_sentence}#{expected_to_sentence}"},
|
|
12
|
+
:failure_message_for_should => lambda {|actual| "expected #{actual} to #{name_to_sentence}#{expected_to_sentence}"},
|
|
13
|
+
:failure_message_for_should_not => lambda {|actual| "expected #{actual} not to #{name_to_sentence}#{expected_to_sentence}"}
|
|
12
14
|
}
|
|
13
15
|
end
|
|
14
16
|
|
|
15
17
|
def matches?(actual)
|
|
16
18
|
@actual = actual
|
|
17
|
-
instance_exec
|
|
18
|
-
instance_exec
|
|
19
|
+
instance_exec(*@expected, &@declarations)
|
|
20
|
+
instance_exec(@actual, &@match_block)
|
|
19
21
|
end
|
|
20
22
|
|
|
21
23
|
def description(&block)
|
|
@@ -37,13 +39,16 @@ module Spec
|
|
|
37
39
|
private
|
|
38
40
|
|
|
39
41
|
def cache_or_call_cached(key, actual=nil, &block)
|
|
40
|
-
block ? @messages[key] = block :
|
|
41
|
-
actual.nil? ? @messages[key].call :
|
|
42
|
-
@messages[key].call(actual)
|
|
42
|
+
block ? @messages[key] = block :
|
|
43
|
+
actual.nil? ? @messages[key].call : @messages[key].call(actual)
|
|
43
44
|
end
|
|
44
45
|
|
|
45
46
|
def name_to_sentence
|
|
46
|
-
@
|
|
47
|
+
split_words(@name)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def expected_to_sentence
|
|
51
|
+
to_sentence(@expected)
|
|
47
52
|
end
|
|
48
53
|
|
|
49
54
|
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module Spec
|
|
2
|
+
module Matchers
|
|
3
|
+
module Pretty
|
|
4
|
+
def split_words(sym)
|
|
5
|
+
sym.to_s.gsub(/_/,' ')
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def to_sentence(words)
|
|
9
|
+
case words.length
|
|
10
|
+
when 0
|
|
11
|
+
""
|
|
12
|
+
when 1
|
|
13
|
+
" #{words[0]}"
|
|
14
|
+
when 2
|
|
15
|
+
" #{words[0]} and #{words[1]}"
|
|
16
|
+
else
|
|
17
|
+
" #{words[0...-1].join(', ')}, and #{words[-1]}"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def _pretty_print(array)
|
|
22
|
+
result = ""
|
|
23
|
+
array.each_with_index do |item, index|
|
|
24
|
+
if index < (array.length - 2)
|
|
25
|
+
result << "#{item.inspect}, "
|
|
26
|
+
elsif index < (array.length - 1)
|
|
27
|
+
result << "#{item.inspect} and "
|
|
28
|
+
else
|
|
29
|
+
result << "#{item.inspect}"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
result
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -3,6 +3,7 @@ module Spec
|
|
|
3
3
|
class RaiseError #:nodoc:
|
|
4
4
|
def initialize(expected_error_or_message=Exception, expected_message=nil, &block)
|
|
5
5
|
@block = block
|
|
6
|
+
@actual_error = nil
|
|
6
7
|
case expected_error_or_message
|
|
7
8
|
when String, Regexp
|
|
8
9
|
@expected_error, @expected_message = Exception, expected_error_or_message
|
|
@@ -18,10 +19,10 @@ module Spec
|
|
|
18
19
|
@eval_block_passed = false
|
|
19
20
|
begin
|
|
20
21
|
given_proc.call
|
|
21
|
-
rescue @expected_error => @
|
|
22
|
+
rescue @expected_error => @actual_error
|
|
22
23
|
@raised_expected_error = true
|
|
23
24
|
@with_expected_message = verify_message
|
|
24
|
-
rescue Exception => @
|
|
25
|
+
rescue Exception => @actual_error
|
|
25
26
|
# This clause should be empty, but rcov will not report it as covered
|
|
26
27
|
# unless something (anything) is executed within the clause
|
|
27
28
|
rcov_error_report = "http://eigenclass.org/hiki.rb?rcov-0.8.0"
|
|
@@ -37,10 +38,10 @@ module Spec
|
|
|
37
38
|
def eval_block
|
|
38
39
|
@eval_block = true
|
|
39
40
|
begin
|
|
40
|
-
@block[@
|
|
41
|
+
@block[@actual_error]
|
|
41
42
|
@eval_block_passed = true
|
|
42
43
|
rescue Exception => err
|
|
43
|
-
@
|
|
44
|
+
@actual_error = err
|
|
44
45
|
end
|
|
45
46
|
end
|
|
46
47
|
|
|
@@ -49,14 +50,14 @@ module Spec
|
|
|
49
50
|
when nil
|
|
50
51
|
true
|
|
51
52
|
when Regexp
|
|
52
|
-
@expected_message =~ @
|
|
53
|
+
@expected_message =~ @actual_error.message
|
|
53
54
|
else
|
|
54
|
-
@expected_message == @
|
|
55
|
+
@expected_message == @actual_error.message
|
|
55
56
|
end
|
|
56
57
|
end
|
|
57
58
|
|
|
58
59
|
def failure_message_for_should
|
|
59
|
-
@eval_block ? @
|
|
60
|
+
@eval_block ? @actual_error.message : "expected #{expected_error}#{given_error}"
|
|
60
61
|
end
|
|
61
62
|
|
|
62
63
|
def failure_message_for_should_not
|
|
@@ -80,7 +81,7 @@ module Spec
|
|
|
80
81
|
end
|
|
81
82
|
|
|
82
83
|
def given_error
|
|
83
|
-
@
|
|
84
|
+
@actual_error.nil? ? " but nothing was raised" : ", got #{@actual_error.inspect}"
|
|
84
85
|
end
|
|
85
86
|
|
|
86
87
|
def negative_expectation?
|
data/lib/spec/mocks/proxy.rb
CHANGED
|
@@ -25,6 +25,7 @@ module Spec
|
|
|
25
25
|
@stubs = []
|
|
26
26
|
@proxied_methods = []
|
|
27
27
|
@options = options ? DEFAULT_OPTIONS.dup.merge(options) : DEFAULT_OPTIONS
|
|
28
|
+
@already_proxied_respond_to = false
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
def null_object?
|
|
@@ -128,8 +129,8 @@ module Spec
|
|
|
128
129
|
end
|
|
129
130
|
|
|
130
131
|
def define_expected_method(sym)
|
|
131
|
-
visibility_string = "#{visibility(sym)} :#{sym}"
|
|
132
132
|
unless @proxied_methods.include?(sym)
|
|
133
|
+
visibility_string = "#{visibility(sym)} :#{sym}"
|
|
133
134
|
if target_responds_to?(sym)
|
|
134
135
|
munged_sym = munge(sym)
|
|
135
136
|
target_metaclass.instance_eval do
|
|
@@ -137,14 +138,13 @@ module Spec
|
|
|
137
138
|
end
|
|
138
139
|
@proxied_methods << sym
|
|
139
140
|
end
|
|
141
|
+
target_metaclass.class_eval(<<-EOF, __FILE__, __LINE__)
|
|
142
|
+
def #{sym}(*args, &block)
|
|
143
|
+
__mock_proxy.message_received :#{sym}, *args, &block
|
|
144
|
+
end
|
|
145
|
+
#{visibility_string}
|
|
146
|
+
EOF
|
|
140
147
|
end
|
|
141
|
-
|
|
142
|
-
target_metaclass.class_eval(<<-EOF, __FILE__, __LINE__)
|
|
143
|
-
def #{sym}(*args, &block)
|
|
144
|
-
__mock_proxy.message_received :#{sym}, *args, &block
|
|
145
|
-
end
|
|
146
|
-
#{visibility_string}
|
|
147
|
-
EOF
|
|
148
148
|
end
|
|
149
149
|
|
|
150
150
|
def target_responds_to?(sym)
|
|
@@ -195,11 +195,10 @@ module Spec
|
|
|
195
195
|
@proxied_methods.each do |sym|
|
|
196
196
|
munged_sym = munge(sym)
|
|
197
197
|
target_metaclass.instance_eval do
|
|
198
|
+
remove_method sym
|
|
198
199
|
if method_defined?(munged_sym)
|
|
199
200
|
alias_method sym, munged_sym
|
|
200
201
|
remove_method munged_sym
|
|
201
|
-
else
|
|
202
|
-
remove_method sym
|
|
203
202
|
end
|
|
204
203
|
end
|
|
205
204
|
end
|
data/lib/spec/runner.rb
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
module Kernel
|
|
2
|
+
unless respond_to?(:debugger)
|
|
3
|
+
# Start a debugging session if ruby-debug is loaded with the -u/--debugger option
|
|
4
|
+
def debugger(steps=1)
|
|
5
|
+
# If not then just comment and proceed
|
|
6
|
+
$stderr.puts "debugger statement ignored, use -u or --debugger option on rspec to enable debugging"
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
module Spec
|
|
2
2
|
module Runner
|
|
3
3
|
module Formatter
|
|
4
|
-
#
|
|
4
|
+
# Formatter base-class, which implements all required methods.
|
|
5
|
+
# Almost all of the implementations are no-ops, with the exception
|
|
6
|
+
# of +add_example_group+ (see below).
|
|
5
7
|
class BaseFormatter
|
|
6
8
|
attr_accessor :example_group, :options, :where
|
|
7
9
|
def initialize(options, where)
|
|
@@ -19,26 +21,35 @@ module Spec
|
|
|
19
21
|
end
|
|
20
22
|
|
|
21
23
|
# This method is invoked at the beginning of the execution of each example_group.
|
|
22
|
-
# +
|
|
24
|
+
# +example_group_proxy+ is an instance of Spec::Example::ExampleGroupProxy, and
|
|
25
|
+
# is assigned as the value returned by subsequent calls to +example_group()+
|
|
23
26
|
#
|
|
24
|
-
# The next method to be invoked after this is #
|
|
25
|
-
def add_example_group(
|
|
26
|
-
@example_group =
|
|
27
|
+
# The next method to be invoked after this is #example_started
|
|
28
|
+
def add_example_group(example_group_proxy)
|
|
29
|
+
@example_group = example_group_proxy
|
|
27
30
|
end
|
|
28
31
|
|
|
29
32
|
# This method is invoked when an +example+ starts.
|
|
30
|
-
|
|
33
|
+
# +example_proxy+ is an instance of Spec::Example::ExampleProxy
|
|
34
|
+
#
|
|
35
|
+
# The next method to be invoked after this is #example_passed, #example_failed,
|
|
36
|
+
# or #example_pending
|
|
37
|
+
def example_started(example_proxy)
|
|
31
38
|
end
|
|
32
39
|
|
|
33
40
|
# This method is invoked when an +example+ passes.
|
|
34
|
-
|
|
41
|
+
# +example_proxy+ is the same instance of Spec::Example::ExampleProxy
|
|
42
|
+
# that was passed to example_started
|
|
43
|
+
def example_passed(example_proxy)
|
|
35
44
|
end
|
|
36
45
|
|
|
37
46
|
# This method is invoked when an +example+ fails, i.e. an exception occurred
|
|
38
47
|
# inside it (such as a failed should or other exception). +counter+ is the
|
|
39
48
|
# sequence number of the failure (starting at 1) and +failure+ is the associated
|
|
40
49
|
# Failure object.
|
|
41
|
-
|
|
50
|
+
# +example_proxy+ is the same instance of Spec::Example::ExampleProxy
|
|
51
|
+
# that was passed to example_started
|
|
52
|
+
def example_failed(example_proxy, counter, failure)
|
|
42
53
|
end
|
|
43
54
|
|
|
44
55
|
# This method is invoked when an example is not yet implemented (i.e. has not
|
|
@@ -47,7 +58,9 @@ module Spec
|
|
|
47
58
|
# default value of "Not Yet Implemented"
|
|
48
59
|
# +pending_caller+ is the file and line number of the spec which
|
|
49
60
|
# has called the pending method
|
|
50
|
-
|
|
61
|
+
# +example_proxy+ is the same instance of Spec::Example::ExampleProxy
|
|
62
|
+
# that was passed to example_started
|
|
63
|
+
def example_pending(example_proxy, message, pending_caller)
|
|
51
64
|
end
|
|
52
65
|
|
|
53
66
|
# This method is invoked after all of the examples have executed. The next method
|
|
@@ -11,6 +11,7 @@ module Spec
|
|
|
11
11
|
super
|
|
12
12
|
@example_group_number = 0
|
|
13
13
|
@example_number = 0
|
|
14
|
+
@header_red = nil
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
def method_missing(sym, *args)
|
|
@@ -172,7 +173,7 @@ EOF
|
|
|
172
173
|
|
|
173
174
|
<div id="rspec-header">
|
|
174
175
|
<div id="label">
|
|
175
|
-
<h1>RSpec
|
|
176
|
+
<h1>RSpec Code Examples</h1>
|
|
176
177
|
</div>
|
|
177
178
|
|
|
178
179
|
<div id="summary">
|