rspec 1.2.7 → 1.2.8
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/History.rdoc +19 -0
- data/Manifest.txt +5 -1
- data/features/expectations/customized_message.feature +54 -0
- data/features/matchers/define_matcher_with_fluent_interface.feature +27 -0
- data/lib/spec/example/example_group_methods.rb +2 -2
- data/lib/spec/example/subject.rb +4 -4
- data/lib/spec/expectations/extensions/kernel.rb +4 -4
- data/lib/spec/expectations/fail_with.rb +4 -2
- data/lib/spec/expectations/handler.rb +8 -8
- data/lib/spec/matchers.rb +3 -3
- data/lib/spec/matchers/be.rb +12 -2
- data/lib/spec/matchers/matcher.rb +2 -1
- data/lib/spec/mocks/message_expectation.rb +22 -19
- data/lib/spec/mocks/methods.rb +14 -3
- data/lib/spec/mocks/proxy.rb +28 -13
- data/lib/spec/runner/differs/default.rb +31 -0
- data/lib/spec/stubs/cucumber.rb +5 -0
- data/lib/spec/version.rb +1 -1
- data/spec/autotest/autotest_matchers.rb +4 -13
- data/spec/spec/example/example_group_methods_spec.rb +1 -1
- data/spec/spec/expectations/differs/default_spec.rb +54 -0
- data/spec/spec/expectations/extensions/{object_spec.rb → kernel_spec.rb} +0 -0
- data/spec/spec/expectations/fail_with_spec.rb +10 -2
- data/spec/spec/expectations/handler_spec.rb +18 -0
- data/spec/spec/matchers/be_spec.rb +2 -2
- data/spec/spec/matchers/have_spec.rb +14 -10
- data/spec/spec/mocks/stub_chain_spec.rb +9 -1
- data/spec/spec/mocks/unstub_spec.rb +127 -0
- data/spec/spec/runner/formatter/html_formatted-1.8.4.html +2 -1
- data/spec/spec/runner/formatter/html_formatted-1.8.5.html +2 -1
- data/spec/spec/runner/formatter/html_formatted-1.8.6.html +2 -1
- data/spec/spec/runner/formatter/html_formatted-1.8.7.html +2 -1
- data/spec/spec/runner/formatter/html_formatted-1.9.1.html +2 -1
- data/spec/spec/runner/formatter/html_formatter_spec.rb +1 -1
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.4.html +2 -1
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +2 -1
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.7.html +2 -1
- data/spec/spec/runner/formatter/text_mate_formatted-1.9.1.html +2 -1
- metadata +10 -6
data/History.rdoc
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
=== Version 1.2.8 / 2008-07-16
|
2
|
+
|
3
|
+
* enhancements
|
4
|
+
* better messages for should[_not] be_nil (Chad Humphries and Rob Sanheim)
|
5
|
+
* should and should_not accept optional custom message
|
6
|
+
(suggestion from Rob Sanheim)
|
7
|
+
* result.should be_nil, "expected result to be nil"
|
8
|
+
* added 'spec/stubs/cucumber' to plug RSpec's stubbing framework into
|
9
|
+
Cucumber scenarios.
|
10
|
+
* added unstub method to remove a stub mid-example (Scott Taylor). Closes
|
11
|
+
#853.
|
12
|
+
* add more readable diff when expected and actual are hashes (Ryan Bigg).
|
13
|
+
Closes #848.
|
14
|
+
|
15
|
+
* bug fixes
|
16
|
+
* fixed --line option for ruby 1.9.1
|
17
|
+
* fix stub_chain conflict between two chains starting with the same message
|
18
|
+
(Mike Rohland). Closes #846.
|
19
|
+
|
1
20
|
=== Version 1.2.7 / 2009-06-22
|
2
21
|
|
3
22
|
* enhancments
|
data/Manifest.txt
CHANGED
@@ -63,6 +63,7 @@ features/command_line/line_number_option_with_example_with_no_name.feature
|
|
63
63
|
features/example_groups/example_group_with_should_methods.feature
|
64
64
|
features/example_groups/implicit_docstrings.feature
|
65
65
|
features/example_groups/nested_groups.feature
|
66
|
+
features/expectations/customized_message.feature
|
66
67
|
features/expectations/expect_change.feature
|
67
68
|
features/expectations/expect_error.feature
|
68
69
|
features/extensions/custom_example_group.feature
|
@@ -75,6 +76,7 @@ features/interop/test_case_with_should_methods.feature
|
|
75
76
|
features/matchers/define_diffable_matcher.feature
|
76
77
|
features/matchers/define_matcher.feature
|
77
78
|
features/matchers/define_matcher_outside_rspec.feature
|
79
|
+
features/matchers/define_matcher_with_fluent_interface.feature
|
78
80
|
features/mock_framework_integration/use_flexmock.feature
|
79
81
|
features/mock_framework_integration/use_mocha.feature
|
80
82
|
features/mock_framework_integration/use_rr.feature
|
@@ -204,6 +206,7 @@ lib/spec/runner/line_number_query.rb
|
|
204
206
|
lib/spec/runner/option_parser.rb
|
205
207
|
lib/spec/runner/options.rb
|
206
208
|
lib/spec/runner/reporter.rb
|
209
|
+
lib/spec/stubs/cucumber.rb
|
207
210
|
lib/spec/test/unit.rb
|
208
211
|
lib/spec/version.rb
|
209
212
|
resources/helpers/cmdline.rb
|
@@ -237,7 +240,7 @@ spec/spec/example/shared_example_group_spec.rb
|
|
237
240
|
spec/spec/example/subclassing_example_group_spec.rb
|
238
241
|
spec/spec/example/subject_spec.rb
|
239
242
|
spec/spec/expectations/differs/default_spec.rb
|
240
|
-
spec/spec/expectations/extensions/
|
243
|
+
spec/spec/expectations/extensions/kernel_spec.rb
|
241
244
|
spec/spec/expectations/fail_with_spec.rb
|
242
245
|
spec/spec/expectations/handler_spec.rb
|
243
246
|
spec/spec/expectations/wrap_expectation_spec.rb
|
@@ -314,6 +317,7 @@ spec/spec/mocks/stub_implementation_spec.rb
|
|
314
317
|
spec/spec/mocks/stub_spec.rb
|
315
318
|
spec/spec/mocks/stubbed_message_expectations_spec.rb
|
316
319
|
spec/spec/mocks/twice_counts_spec.rb
|
320
|
+
spec/spec/mocks/unstub_spec.rb
|
317
321
|
spec/spec/package/bin_spec_spec.rb
|
318
322
|
spec/spec/rake/spectask_spec.rb
|
319
323
|
spec/spec/runner/class_and_argument_parser_spec.rb
|
@@ -0,0 +1,54 @@
|
|
1
|
+
Feature: customized message
|
2
|
+
|
3
|
+
In order to get the feedback I want
|
4
|
+
As an RSpec user
|
5
|
+
I want to customize the failure message per example
|
6
|
+
|
7
|
+
Scenario: one additional method
|
8
|
+
Given a file named "node_spec.rb.rb" with:
|
9
|
+
"""
|
10
|
+
class Node
|
11
|
+
def initialize(state=:waiting)
|
12
|
+
@state = state
|
13
|
+
end
|
14
|
+
def state
|
15
|
+
@state
|
16
|
+
end
|
17
|
+
def waiting?
|
18
|
+
@state == :waiting
|
19
|
+
end
|
20
|
+
def started?
|
21
|
+
@state == :started
|
22
|
+
end
|
23
|
+
def start
|
24
|
+
@state = :started
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "a new Node" do
|
29
|
+
it "should be waiting" do
|
30
|
+
node = Node.new(:started) #start w/ started to trigger failure
|
31
|
+
node.should be_waiting, "node.state: #{node.state} (first example)"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should not be started" do
|
35
|
+
node = Node.new(:started) #start w/ started to trigger failure
|
36
|
+
node.should_not be_started, "node.state: #{node.state} (second example)"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "node.start" do
|
41
|
+
it "should change the state" do
|
42
|
+
node = Node.new(:started) #start w/ started to trigger failure
|
43
|
+
lambda {node.start}.should change{node.state}, "expected a change"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
"""
|
48
|
+
When I run "spec node_spec.rb.rb --format specdoc"
|
49
|
+
Then the stdout should match "3 examples, 3 failures"
|
50
|
+
And the stdout should not match "to return true, got false"
|
51
|
+
And the stdout should not match "to return false, got true"
|
52
|
+
And the stdout should match "node.state: started (first example)"
|
53
|
+
And the stdout should match "node.state: started (second example)"
|
54
|
+
And the stdout should match "expected a change"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Feature: define matcher
|
2
|
+
|
3
|
+
In order to express my domain clearly in my code examples
|
4
|
+
As an RSpec user
|
5
|
+
I want to define matchers with fluent interfaces
|
6
|
+
|
7
|
+
Scenario: one additional method
|
8
|
+
Given a file named "between_spec.rb" with:
|
9
|
+
"""
|
10
|
+
Spec::Matchers.define :be_bigger_than do |first|
|
11
|
+
def but_smaller_than(second)
|
12
|
+
@second = second
|
13
|
+
self
|
14
|
+
end
|
15
|
+
|
16
|
+
match do |actual|
|
17
|
+
(actual > first) && (actual < @second)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 5 do
|
22
|
+
it { should be_bigger_than(4).but_smaller_than(6) }
|
23
|
+
end
|
24
|
+
"""
|
25
|
+
When I run "spec between_spec.rb --format specdoc"
|
26
|
+
Then the stdout should match "1 example, 0 failures"
|
27
|
+
And the stdout should match "should be bigger than 4"
|
@@ -226,10 +226,10 @@ module Spec
|
|
226
226
|
def examples_to_run(run_options)
|
227
227
|
return example_proxies unless examples_were_specified?(run_options)
|
228
228
|
if run_options.line_number_requested?
|
229
|
-
if location =~ /:#{run_options.example_line}
|
229
|
+
if location =~ /:#{run_options.example_line}:?/
|
230
230
|
example_proxies
|
231
231
|
else
|
232
|
-
example_proxies.select {|proxy| proxy.location =~ /:#{run_options.example_line}
|
232
|
+
example_proxies.select {|proxy| proxy.location =~ /:#{run_options.example_line}:?/}
|
233
233
|
end
|
234
234
|
else
|
235
235
|
example_proxies.reject do |proxy|
|
data/lib/spec/example/subject.rb
CHANGED
@@ -79,8 +79,8 @@ module Spec
|
|
79
79
|
# describe Person do
|
80
80
|
# it { should be_eligible_to_vote }
|
81
81
|
# end
|
82
|
-
def should(matcher=nil)
|
83
|
-
self == subject ? self.__should_for_example_group__(matcher) : subject.should(matcher)
|
82
|
+
def should(matcher=nil, message=nil)
|
83
|
+
self == subject ? self.__should_for_example_group__(matcher) : subject.should(matcher,message)
|
84
84
|
end
|
85
85
|
|
86
86
|
# Just like +should+, +should_not+ delegates to the subject (implicit or
|
@@ -91,8 +91,8 @@ module Spec
|
|
91
91
|
# describe Person do
|
92
92
|
# it { should_not be_eligible_to_vote }
|
93
93
|
# end
|
94
|
-
def should_not(matcher=nil)
|
95
|
-
self == subject ? self.__should_not_for_example_group__(matcher) : subject.should_not(matcher)
|
94
|
+
def should_not(matcher=nil, message=nil)
|
95
|
+
self == subject ? self.__should_not_for_example_group__(matcher) : subject.should_not(matcher,message)
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
@@ -23,8 +23,8 @@ module Kernel
|
|
23
23
|
#
|
24
24
|
# NOTE that this does NOT support receiver.should != expected.
|
25
25
|
# Instead, use receiver.should_not == expected
|
26
|
-
def should(matcher=nil, &block)
|
27
|
-
Spec::Expectations::PositiveExpectationHandler.handle_matcher(self, matcher, &block)
|
26
|
+
def should(matcher=nil, message=nil, &block)
|
27
|
+
Spec::Expectations::PositiveExpectationHandler.handle_matcher(self, matcher, message, &block)
|
28
28
|
end
|
29
29
|
|
30
30
|
# :call-seq:
|
@@ -46,7 +46,7 @@ module Kernel
|
|
46
46
|
# => Passes unless (receiver =~ regexp)
|
47
47
|
#
|
48
48
|
# See Spec::Matchers for more information about matchers
|
49
|
-
def should_not(matcher=nil, &block)
|
50
|
-
Spec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, &block)
|
49
|
+
def should_not(matcher=nil, message=nil, &block)
|
50
|
+
Spec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, message, &block)
|
51
51
|
end
|
52
52
|
end
|
@@ -31,9 +31,11 @@ NOTICE
|
|
31
31
|
end
|
32
32
|
unless (differ.nil? || expected.nil? || target.nil?)
|
33
33
|
if expected.is_a?(String)
|
34
|
-
message << "\
|
34
|
+
message << "\n\n Diff:" << self.differ.diff_as_string(target.to_s, expected)
|
35
|
+
elsif expected.is_a?(Hash) && target.is_a?(Hash)
|
36
|
+
message << "\n\n Diff:" << self.differ.diff_as_hash(target, expected)
|
35
37
|
elsif !target.is_a?(Proc)
|
36
|
-
message << "\
|
38
|
+
message << "\n\n Diff:" << self.differ.diff_as_object(target, expected)
|
37
39
|
end
|
38
40
|
end
|
39
41
|
Kernel::raise(Spec::Expectations::ExpectationNotMetError.new(message))
|
@@ -3,7 +3,7 @@ module Spec
|
|
3
3
|
class InvalidMatcherError < ArgumentError; end
|
4
4
|
|
5
5
|
class PositiveExpectationHandler
|
6
|
-
def self.handle_matcher(actual, matcher, &block)
|
6
|
+
def self.handle_matcher(actual, matcher, message=nil, &block)
|
7
7
|
::Spec::Matchers.last_should = :should
|
8
8
|
::Spec::Matchers.last_matcher = matcher
|
9
9
|
return ::Spec::Matchers::PositiveOperatorMatcher.new(actual) if matcher.nil?
|
@@ -11,9 +11,9 @@ module Spec
|
|
11
11
|
match = matcher.matches?(actual, &block)
|
12
12
|
return match if match
|
13
13
|
|
14
|
-
message
|
15
|
-
|
16
|
-
|
14
|
+
message ||= matcher.respond_to?(:failure_message_for_should) ?
|
15
|
+
matcher.failure_message_for_should :
|
16
|
+
matcher.failure_message
|
17
17
|
|
18
18
|
if matcher.respond_to?(:diffable?) && matcher.diffable?
|
19
19
|
::Spec::Expectations.fail_with message, matcher.expected.first, matcher.actual
|
@@ -24,7 +24,7 @@ module Spec
|
|
24
24
|
end
|
25
25
|
|
26
26
|
class NegativeExpectationHandler
|
27
|
-
def self.handle_matcher(actual, matcher, &block)
|
27
|
+
def self.handle_matcher(actual, matcher, message=nil, &block)
|
28
28
|
::Spec::Matchers.last_should = :should_not
|
29
29
|
::Spec::Matchers.last_matcher = matcher
|
30
30
|
return ::Spec::Matchers::NegativeOperatorMatcher.new(actual) if matcher.nil?
|
@@ -34,9 +34,9 @@ module Spec
|
|
34
34
|
matcher.matches?(actual, &block)
|
35
35
|
return match unless match
|
36
36
|
|
37
|
-
message
|
38
|
-
|
39
|
-
|
37
|
+
message ||= matcher.respond_to?(:failure_message_for_should_not) ?
|
38
|
+
matcher.failure_message_for_should_not :
|
39
|
+
matcher.negative_failure_message
|
40
40
|
|
41
41
|
if matcher.respond_to?(:diffable?) && matcher.diffable?
|
42
42
|
::Spec::Expectations.fail_with message, matcher.expected.first, matcher.actual
|
data/lib/spec/matchers.rb
CHANGED
@@ -108,7 +108,7 @@ module Spec
|
|
108
108
|
#
|
109
109
|
# You can create such a matcher like so:
|
110
110
|
#
|
111
|
-
# Spec::Matchers.
|
111
|
+
# Spec::Matchers.define :be_in_zone do |zone|
|
112
112
|
# match do |player|
|
113
113
|
# player.in_zone?(zone)
|
114
114
|
# end
|
@@ -118,7 +118,7 @@ module Spec
|
|
118
118
|
# with logical default messages for failures. You can override the failure
|
119
119
|
# messages and the generated description as follows:
|
120
120
|
#
|
121
|
-
# Spec::Matchers.
|
121
|
+
# Spec::Matchers.define :be_in_zone do |zone|
|
122
122
|
# match do |player|
|
123
123
|
# player.in_zone?(zone)
|
124
124
|
# end
|
@@ -192,4 +192,4 @@ module Spec
|
|
192
192
|
# end
|
193
193
|
#
|
194
194
|
module Matchers; end
|
195
|
-
end
|
195
|
+
end
|
data/lib/spec/matchers/be.rb
CHANGED
@@ -30,14 +30,24 @@ module Spec
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def failure_message_for_should
|
33
|
-
handling_predicate?
|
34
|
-
|
33
|
+
if handling_predicate?
|
34
|
+
if predicate == :nil?
|
35
|
+
"expected nil, got #{@actual.inspect}"
|
36
|
+
else
|
37
|
+
"expected #{predicate}#{args_to_s} to return true, got #{@result.inspect}"
|
38
|
+
end
|
39
|
+
else
|
35
40
|
"expected #{@comparison_method} #{expected}, got #{@actual.inspect}".gsub(' ',' ')
|
41
|
+
end
|
36
42
|
end
|
37
43
|
|
38
44
|
def failure_message_for_should_not
|
39
45
|
if handling_predicate?
|
46
|
+
if predicate == :nil?
|
47
|
+
"expected not nil, got nil"
|
48
|
+
else
|
40
49
|
"expected #{predicate}#{args_to_s} to return false, got #{@result.inspect}"
|
50
|
+
end
|
41
51
|
else
|
42
52
|
message = <<-MESSAGE
|
43
53
|
'should_not be #{@comparison_method} #{expected}' not only FAILED,
|
@@ -6,8 +6,9 @@ module Spec
|
|
6
6
|
attr_reader :expected, :actual
|
7
7
|
|
8
8
|
def initialize(name, *expected, &declarations)
|
9
|
-
@name
|
9
|
+
@name = name
|
10
10
|
@expected = expected
|
11
|
+
@actual = nil
|
11
12
|
@diffable = false
|
12
13
|
@messages = {
|
13
14
|
:description => lambda {"#{name_to_sentence}#{expected_to_sentence}"},
|
@@ -14,7 +14,6 @@ module Spec
|
|
14
14
|
@expected_from = expected_from
|
15
15
|
@sym = sym
|
16
16
|
@method_block = method_block
|
17
|
-
@return_block = nil
|
18
17
|
@actual_received_count = 0
|
19
18
|
@expected_received_count = expected_received_count
|
20
19
|
@args_expectation = ArgumentExpectation.new([ArgumentMatchers::AnyArgsMatcher.new])
|
@@ -94,7 +93,7 @@ module Spec
|
|
94
93
|
@sym == sym and @args_expectation.args_match?(args)
|
95
94
|
end
|
96
95
|
|
97
|
-
def invoke(args, block)
|
96
|
+
def invoke(*args, &block)
|
98
97
|
if @expected_received_count == 0
|
99
98
|
@failed_fast = true
|
100
99
|
@actual_received_count += 1
|
@@ -109,17 +108,17 @@ module Spec
|
|
109
108
|
|
110
109
|
|
111
110
|
if !@method_block.nil?
|
112
|
-
default_return_val = invoke_method_block(args)
|
111
|
+
default_return_val = invoke_method_block(*args)
|
113
112
|
elsif @args_to_yield.size > 0
|
114
|
-
default_return_val = invoke_with_yield(block)
|
113
|
+
default_return_val = invoke_with_yield(&block)
|
115
114
|
else
|
116
115
|
default_return_val = nil
|
117
116
|
end
|
118
117
|
|
119
118
|
if @consecutive
|
120
|
-
return invoke_consecutive_return_block(args, block)
|
119
|
+
return invoke_consecutive_return_block(*args, &block)
|
121
120
|
elsif @return_block
|
122
|
-
return invoke_return_block(args, block)
|
121
|
+
return invoke_return_block(*args, &block)
|
123
122
|
else
|
124
123
|
return default_return_val
|
125
124
|
end
|
@@ -133,9 +132,17 @@ module Spec
|
|
133
132
|
@actual_received_count >= @expected_received_count
|
134
133
|
end
|
135
134
|
|
135
|
+
def invoke_return_block(*args, &block)
|
136
|
+
args << block unless block.nil?
|
137
|
+
# Ruby 1.9 - when we set @return_block to return values
|
138
|
+
# regardless of arguments, any arguments will result in
|
139
|
+
# a "wrong number of arguments" error
|
140
|
+
@return_block.arity == 0 ? @return_block.call : @return_block.call(*args)
|
141
|
+
end
|
142
|
+
|
136
143
|
protected
|
137
144
|
|
138
|
-
def invoke_method_block(args)
|
145
|
+
def invoke_method_block(*args)
|
139
146
|
begin
|
140
147
|
@method_block.call(*args)
|
141
148
|
rescue => detail
|
@@ -143,7 +150,7 @@ module Spec
|
|
143
150
|
end
|
144
151
|
end
|
145
152
|
|
146
|
-
def invoke_with_yield(block)
|
153
|
+
def invoke_with_yield(&block)
|
147
154
|
if block.nil?
|
148
155
|
@error_generator.raise_missing_block_error @args_to_yield
|
149
156
|
end
|
@@ -157,20 +164,12 @@ module Spec
|
|
157
164
|
value
|
158
165
|
end
|
159
166
|
|
160
|
-
def invoke_consecutive_return_block(args, block)
|
161
|
-
value = invoke_return_block(args, block)
|
167
|
+
def invoke_consecutive_return_block(*args, &block)
|
168
|
+
value = invoke_return_block(*args, &block)
|
162
169
|
index = [@actual_received_count, value.size-1].min
|
163
170
|
value[index]
|
164
171
|
end
|
165
172
|
|
166
|
-
def invoke_return_block(args, block)
|
167
|
-
args << block unless block.nil?
|
168
|
-
# Ruby 1.9 - when we set @return_block to return values
|
169
|
-
# regardless of arguments, any arguments will result in
|
170
|
-
# a "wrong number of arguments" error
|
171
|
-
@return_block.arity == 0 ? @return_block.call : @return_block.call(*args)
|
172
|
-
end
|
173
|
-
|
174
173
|
def clone_args_to_yield(args)
|
175
174
|
@args_to_yield = args.clone
|
176
175
|
@args_to_yield_were_cloned = true
|
@@ -182,9 +181,13 @@ module Spec
|
|
182
181
|
end
|
183
182
|
|
184
183
|
class MessageExpectation < BaseExpectation
|
184
|
+
|
185
|
+
def matches_name?(sym)
|
186
|
+
@sym == sym
|
187
|
+
end
|
185
188
|
|
186
189
|
def matches_name_but_not_args(sym, args)
|
187
|
-
|
190
|
+
matches_name?(sym) and not @args_expectation.args_match?(args)
|
188
191
|
end
|
189
192
|
|
190
193
|
def verify_messages_received
|
data/lib/spec/mocks/methods.rb
CHANGED
@@ -19,11 +19,22 @@ module Spec
|
|
19
19
|
|
20
20
|
alias_method :stub, :stub!
|
21
21
|
|
22
|
+
def unstub!(message)
|
23
|
+
__mock_proxy.remove_stub(message)
|
24
|
+
end
|
25
|
+
|
26
|
+
alias_method :unstub, :unstub!
|
27
|
+
|
22
28
|
def stub_chain(*methods)
|
23
29
|
if methods.length > 1
|
24
|
-
|
25
|
-
|
26
|
-
|
30
|
+
if matching_stub = __mock_proxy.find_matching_method_stub(methods[0])
|
31
|
+
methods.shift
|
32
|
+
matching_stub.invoke_return_block.stub_chain(*methods)
|
33
|
+
else
|
34
|
+
next_in_chain = Object.new
|
35
|
+
stub!(methods.shift) {next_in_chain}
|
36
|
+
next_in_chain.stub_chain(*methods)
|
37
|
+
end
|
27
38
|
else
|
28
39
|
stub!(methods.shift)
|
29
40
|
end
|
data/lib/spec/mocks/proxy.rb
CHANGED
@@ -61,6 +61,17 @@ module Spec
|
|
61
61
|
@stubs.unshift MessageExpectation.new(@error_generator, @expectation_ordering, expected_from, sym, nil, :any, opts, &implementation)
|
62
62
|
@stubs.first
|
63
63
|
end
|
64
|
+
|
65
|
+
def remove_stub(message)
|
66
|
+
message = message.to_sym
|
67
|
+
|
68
|
+
if stub_to_remove = @stubs.detect { |s| s.matches_name?(message) }
|
69
|
+
reset_proxied_method(message)
|
70
|
+
@stubs.delete(stub_to_remove)
|
71
|
+
else
|
72
|
+
raise MockExpectationError, "The method `#{message}` was not stubbed or was already unstubbed"
|
73
|
+
end
|
74
|
+
end
|
64
75
|
|
65
76
|
def verify #:nodoc:
|
66
77
|
verify_expectations
|
@@ -96,9 +107,9 @@ module Spec
|
|
96
107
|
if expectation = find_almost_matching_expectation(sym, *args)
|
97
108
|
expectation.advise(args, block) unless expectation.expected_messages_received?
|
98
109
|
end
|
99
|
-
stub.invoke(args, block)
|
110
|
+
stub.invoke(*args, &block)
|
100
111
|
elsif expectation
|
101
|
-
expectation.invoke(args, block)
|
112
|
+
expectation.invoke(*args, &block)
|
102
113
|
elsif expectation = find_almost_matching_expectation(sym, *args)
|
103
114
|
expectation.advise(args, block) if null_object? unless expectation.expected_messages_received?
|
104
115
|
raise_unexpected_message_args_error(expectation, *args) unless (has_negative_expectation?(sym) or null_object?)
|
@@ -115,6 +126,10 @@ module Spec
|
|
115
126
|
@error_generator.raise_unexpected_message_error sym, *args
|
116
127
|
end
|
117
128
|
|
129
|
+
def find_matching_method_stub(sym, *args)
|
130
|
+
@stubs.find {|stub| stub.matches(sym, args)}
|
131
|
+
end
|
132
|
+
|
118
133
|
private
|
119
134
|
|
120
135
|
def __add(sym)
|
@@ -193,13 +208,17 @@ module Spec
|
|
193
208
|
|
194
209
|
def reset_proxied_methods
|
195
210
|
@proxied_methods.each do |sym|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
211
|
+
reset_proxied_method(sym)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
def reset_proxied_method(sym)
|
216
|
+
munged_sym = munge(sym)
|
217
|
+
target_metaclass.instance_eval do
|
218
|
+
remove_method sym
|
219
|
+
if method_defined?(munged_sym)
|
220
|
+
alias_method sym, munged_sym
|
221
|
+
remove_method munged_sym
|
203
222
|
end
|
204
223
|
end
|
205
224
|
end
|
@@ -221,10 +240,6 @@ module Spec
|
|
221
240
|
@expectations.find {|expectation| expectation.matches_name_but_not_args(sym, args)}
|
222
241
|
end
|
223
242
|
|
224
|
-
def find_matching_method_stub(sym, *args)
|
225
|
-
@stubs.find {|stub| stub.matches(sym, args)}
|
226
|
-
end
|
227
|
-
|
228
243
|
end
|
229
244
|
end
|
230
245
|
end
|
@@ -45,6 +45,37 @@ module Spec
|
|
45
45
|
def diff_as_object(target,expected)
|
46
46
|
diff_as_string(PP.pp(target,""), PP.pp(expected,""))
|
47
47
|
end
|
48
|
+
|
49
|
+
def diff_as_hash(target, expected)
|
50
|
+
contains_hash = false
|
51
|
+
contains_array = false
|
52
|
+
|
53
|
+
extra_expected_keys = expected.keys - target.keys
|
54
|
+
extra_target_keys = target.keys - expected.keys
|
55
|
+
|
56
|
+
o = "\n"
|
57
|
+
|
58
|
+
o << "Expected hash contains keys that target hash does not: " << extra_expected_keys.inspect << "\n" if !extra_expected_keys.empty?
|
59
|
+
o << "Target hash contains keys that expected hash does not: " << extra_target_keys.inspect << "\n" if !extra_target_keys.empty?
|
60
|
+
|
61
|
+
expected.delete_if do |key, value|
|
62
|
+
contains_hash = true if value.is_a?(Hash)
|
63
|
+
contains_array = true if value.is_a?(Array)
|
64
|
+
target[key] == value
|
65
|
+
end
|
66
|
+
|
67
|
+
expected.keys.sort { |a,b| a.to_s <=> b.to_s }.each do |key|
|
68
|
+
o << "Expected the key #{key.inspect} to be #{expected[key].inspect}, but was #{target[key].inspect}\n"
|
69
|
+
end
|
70
|
+
|
71
|
+
o << "\n"
|
72
|
+
|
73
|
+
if contains_hash || contains_array
|
74
|
+
o << diff_as_object(target, expected)
|
75
|
+
else
|
76
|
+
o
|
77
|
+
end
|
78
|
+
end
|
48
79
|
|
49
80
|
protected
|
50
81
|
def format
|
data/lib/spec/version.rb
CHANGED
@@ -11,7 +11,7 @@ module Spec
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def matches?(autotest)
|
14
|
-
@autotest = prepare
|
14
|
+
@autotest = prepare(autotest)
|
15
15
|
@actual = autotest.test_files_for(@file)
|
16
16
|
@actual == @specs
|
17
17
|
end
|
@@ -20,21 +20,12 @@ module Spec
|
|
20
20
|
"expected #{@autotest.class} to map #{@specs.inspect} to #{@file.inspect}\ngot #{@actual.inspect}"
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
def prepare autotest
|
25
|
-
stub_found_files autotest
|
26
|
-
stub_find_order autotest
|
27
|
-
autotest
|
28
|
-
end
|
29
|
-
|
30
|
-
def stub_found_files autotest
|
31
|
-
found_files = @specs.inject({}){|h,f| h[f] = Time.at(0)}
|
32
|
-
autotest.stub!(:find_files).and_return(found_files)
|
33
|
-
end
|
23
|
+
private
|
34
24
|
|
35
|
-
def
|
25
|
+
def prepare(autotest)
|
36
26
|
find_order = @specs.dup << @file
|
37
27
|
autotest.instance_eval { @find_order = find_order }
|
28
|
+
autotest
|
38
29
|
end
|
39
30
|
|
40
31
|
end
|
@@ -73,6 +73,60 @@ EOD
|
|
73
73
|
diff = @differ.diff_as_object(expected,actual)
|
74
74
|
diff.should == expected_diff
|
75
75
|
end
|
76
|
+
|
77
|
+
it "should output a friendly message if comparing simple hashes" do
|
78
|
+
expected = { "foo" => "bar" }
|
79
|
+
actual = { "foo" => "baz" }
|
80
|
+
|
81
|
+
expected_diff = <<'EOD'
|
82
|
+
|
83
|
+
Expected the key "foo" to be "bar", but was "baz"
|
84
|
+
|
85
|
+
EOD
|
86
|
+
|
87
|
+
|
88
|
+
diff = @differ.diff_as_hash(actual, expected)
|
89
|
+
diff.should == expected_diff
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
it "should output a friendly message if comparing simple hashes that contain different keys" do
|
94
|
+
expected = { "bar" => "foo" }
|
95
|
+
actual = { "foo" => "baz" }
|
96
|
+
|
97
|
+
expected_diff = <<'EOD'
|
98
|
+
|
99
|
+
Expected hash contains keys that target hash does not: ["bar"]
|
100
|
+
Target hash contains keys that expected hash does not: ["foo"]
|
101
|
+
Expected the key "bar" to be "foo", but was nil
|
102
|
+
|
103
|
+
EOD
|
104
|
+
|
105
|
+
|
106
|
+
diff = @differ.diff_as_hash(actual, expected)
|
107
|
+
diff.should == expected_diff
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should output diff message if the hash is complex (containing Array or Hash)" do
|
111
|
+
expected = { "foo" => "bar", "fizz" => [1, 2, 3] }
|
112
|
+
actual = { "foo" => "baz", "fizz" => [1, 2] }
|
113
|
+
|
114
|
+
expected_diff = <<'EOD'
|
115
|
+
|
116
|
+
Expected the key "fizz" to be [1, 2, 3], but was [1, 2]
|
117
|
+
Expected the key "foo" to be "bar", but was "baz"
|
118
|
+
|
119
|
+
|
120
|
+
@@ -1,2 +1,2 @@
|
121
|
+
-{"foo"=>"bar", "fizz"=>[1, 2, 3]}
|
122
|
+
+{"foo"=>"baz", "fizz"=>[1, 2]}
|
123
|
+
EOD
|
124
|
+
|
125
|
+
|
126
|
+
diff = @differ.diff_as_hash(actual, expected)
|
127
|
+
diff.should == expected_diff
|
128
|
+
end
|
129
|
+
|
76
130
|
|
77
131
|
it "should output unified diff message of two objects" do
|
78
132
|
expected = Spec::Fixtures::Animal.new "bob", "giraffe"
|
File without changes
|
@@ -47,19 +47,27 @@ describe Spec::Expectations, "#fail_with with diff" do
|
|
47
47
|
@differ.should_receive(:diff_as_string).and_return("diff")
|
48
48
|
lambda {
|
49
49
|
Spec::Expectations.fail_with "the message", "expected", "actual"
|
50
|
-
}.should fail_with("the message\
|
50
|
+
}.should fail_with("the message\n\n Diff:diff")
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should call differ if expected/actual are not strings" do
|
54
54
|
@differ.should_receive(:diff_as_object).and_return("diff")
|
55
55
|
lambda {
|
56
56
|
Spec::Expectations.fail_with "the message", :expected, :actual
|
57
|
-
}.should fail_with("the message\
|
57
|
+
}.should fail_with("the message\n\n Diff:diff")
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should call differ if expected/actual are both hashes" do
|
61
|
+
@differ.should_receive(:diff_as_hash).and_return("diff")
|
62
|
+
lambda {
|
63
|
+
Spec::Expectations.fail_with "the message", {:a => :b}, {:a => 'b'}
|
64
|
+
}.should fail_with("the message\n\n Diff:diff")
|
58
65
|
end
|
59
66
|
|
60
67
|
it "should not call differ if expected or actual are procs" do
|
61
68
|
@differ.should_not_receive(:diff_as_string)
|
62
69
|
@differ.should_not_receive(:diff_as_object)
|
70
|
+
@differ.should_not_receive(:diff_as_hash)
|
63
71
|
lambda {
|
64
72
|
Spec::Expectations.fail_with "the message", lambda {}, lambda {}
|
65
73
|
}.should fail_with("the message")
|
@@ -95,6 +95,15 @@ module Spec
|
|
95
95
|
Spec::Expectations::PositiveExpectationHandler.handle_matcher(actual, matcher)
|
96
96
|
|
97
97
|
end
|
98
|
+
|
99
|
+
it "appends the :or message in the options hash passed to should" do
|
100
|
+
matcher = mock("matcher", :failure_message_for_should => "message", :matches? => false)
|
101
|
+
actual = Object.new
|
102
|
+
|
103
|
+
::Spec::Expectations.should_receive(:fail_with).with("custom")
|
104
|
+
|
105
|
+
Spec::Expectations::PositiveExpectationHandler.handle_matcher(actual, matcher, "custom")
|
106
|
+
end
|
98
107
|
end
|
99
108
|
end
|
100
109
|
|
@@ -160,6 +169,15 @@ module Spec
|
|
160
169
|
Spec::Expectations::NegativeExpectationHandler.handle_matcher(actual, matcher)
|
161
170
|
end
|
162
171
|
|
172
|
+
it "appends the :or message in the options hash passed to should" do
|
173
|
+
matcher = mock("matcher", :failure_message_for_should_not => "message", :matches? => true)
|
174
|
+
actual = Object.new
|
175
|
+
|
176
|
+
::Spec::Expectations.should_receive(:fail_with).with("custom")
|
177
|
+
|
178
|
+
Spec::Expectations::NegativeExpectationHandler.handle_matcher(actual, matcher, "custom")
|
179
|
+
end
|
180
|
+
|
163
181
|
end
|
164
182
|
end
|
165
183
|
|
@@ -137,7 +137,7 @@ describe "should be_nil" do
|
|
137
137
|
it "should fail when actual is not nil" do
|
138
138
|
lambda {
|
139
139
|
:not_nil.should be_nil
|
140
|
-
}.should fail_with("expected nil
|
140
|
+
}.should fail_with("expected nil, got :not_nil")
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
@@ -149,7 +149,7 @@ describe "should_not be_nil" do
|
|
149
149
|
it "should fail when actual is nil" do
|
150
150
|
lambda {
|
151
151
|
nil.should_not be_nil
|
152
|
-
}.should fail_with("expected nil
|
152
|
+
}.should fail_with("expected not nil, got nil")
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
@@ -3,15 +3,17 @@ require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
|
3
3
|
share_as :HaveSpecHelper do
|
4
4
|
def create_collection_owner_with(n)
|
5
5
|
owner = Spec::Expectations::Helper::CollectionOwner.new
|
6
|
-
(1..n).each do |
|
7
|
-
owner.add_to_collection_with_length_method(
|
8
|
-
owner.add_to_collection_with_size_method(
|
6
|
+
(1..n).each do |number|
|
7
|
+
owner.add_to_collection_with_length_method(number)
|
8
|
+
owner.add_to_collection_with_size_method(number)
|
9
9
|
end
|
10
10
|
owner
|
11
11
|
end
|
12
12
|
before(:each) do
|
13
|
-
|
14
|
-
@
|
13
|
+
if defined?(::ActiveSupport::Inflector)
|
14
|
+
@active_support_was_defined = true
|
15
|
+
else
|
16
|
+
@active_support_was_defined = false
|
15
17
|
module ::ActiveSupport
|
16
18
|
class Inflector
|
17
19
|
def self.pluralize(string)
|
@@ -69,7 +71,7 @@ describe 'should have(1).item when ActiveSupport::Inflector is defined' do
|
|
69
71
|
end
|
70
72
|
|
71
73
|
after(:each) do
|
72
|
-
|
74
|
+
unless @active_support_was_defined
|
73
75
|
Object.__send__ :remove_const, :ActiveSupport
|
74
76
|
end
|
75
77
|
end
|
@@ -79,9 +81,11 @@ describe 'should have(1).item when Inflector is defined' do
|
|
79
81
|
include HaveSpecHelper
|
80
82
|
|
81
83
|
before(:each) do
|
82
|
-
|
83
|
-
@
|
84
|
-
|
84
|
+
if defined?(Inflector)
|
85
|
+
@inflector_was_defined = true
|
86
|
+
else
|
87
|
+
@inflector_was_defined = false
|
88
|
+
class ::Inflector
|
85
89
|
def self.pluralize(string)
|
86
90
|
string.to_s + 's'
|
87
91
|
end
|
@@ -95,7 +99,7 @@ describe 'should have(1).item when Inflector is defined' do
|
|
95
99
|
end
|
96
100
|
|
97
101
|
after(:each) do
|
98
|
-
|
102
|
+
unless @inflector_was_defined
|
99
103
|
Object.__send__ :remove_const, :Inflector
|
100
104
|
end
|
101
105
|
end
|
@@ -22,13 +22,21 @@ module Spec
|
|
22
22
|
@subject.msg1.msg2.msg3.msg4.should equal(:return_value)
|
23
23
|
end
|
24
24
|
|
25
|
-
it "returns expected value from
|
25
|
+
it "returns expected value from two chains with shared messages at the end" do
|
26
26
|
@subject.stub_chain(:msg1, :msg2, :msg3, :msg4).and_return(:first)
|
27
27
|
@subject.stub_chain(:msg5, :msg2, :msg3, :msg4).and_return(:second)
|
28
28
|
|
29
29
|
@subject.msg1.msg2.msg3.msg4.should equal(:first)
|
30
30
|
@subject.msg5.msg2.msg3.msg4.should equal(:second)
|
31
31
|
end
|
32
|
+
|
33
|
+
it "returns expected value from two chains with shared messages at the beginning" do
|
34
|
+
@subject.stub_chain(:msg1, :msg2, :msg3, :msg4).and_return(:first)
|
35
|
+
@subject.stub_chain(:msg1, :msg2, :msg3, :msg5).and_return(:second)
|
36
|
+
|
37
|
+
@subject.msg1.msg2.msg3.msg4.should equal(:first)
|
38
|
+
@subject.msg1.msg2.msg3.msg5.should equal(:second)
|
39
|
+
end
|
32
40
|
end
|
33
41
|
end
|
34
42
|
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
module Spec
|
4
|
+
module Mocks
|
5
|
+
describe Mock do
|
6
|
+
context "unstubbing a mock object with a stub" do
|
7
|
+
it "should remove the stub" do
|
8
|
+
a_mock = mock 'an object', :foo => :bar
|
9
|
+
|
10
|
+
a_mock.unstub! :foo
|
11
|
+
a_mock.should_not respond_to(:foo)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "unstubbing a real object with a stub" do
|
16
|
+
before do
|
17
|
+
@obj = Object.new
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should raise a NoMethodError if the message is called after unstubbing" do
|
21
|
+
@obj.stub!(:foo).and_return :bar
|
22
|
+
@obj.unstub!(:foo)
|
23
|
+
|
24
|
+
lambda {
|
25
|
+
@obj.foo
|
26
|
+
}.should raise_error(NoMethodError)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should only clear the stub specified" do
|
30
|
+
@obj.stub!(:foo).and_return :bar
|
31
|
+
@obj.stub!(:other).and_return :baz
|
32
|
+
|
33
|
+
@obj.unstub!(:foo)
|
34
|
+
|
35
|
+
@obj.other.should == :baz
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should no longer respond_to? the method" do
|
39
|
+
@obj.stub!(:foo).and_return :bar
|
40
|
+
@obj.unstub!(:foo)
|
41
|
+
|
42
|
+
@obj.should_not respond_to(:foo)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should unstub using a string (should convert the string to a symbol)" do
|
46
|
+
@obj.stub!(:foo)
|
47
|
+
|
48
|
+
@obj.unstub!("foo")
|
49
|
+
|
50
|
+
@obj.should_not respond_to(:foo)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should restore a previous method definition" do
|
54
|
+
def @obj.foo
|
55
|
+
:a_result
|
56
|
+
end
|
57
|
+
|
58
|
+
@obj.stub!(:foo).and_return :stubbed_result
|
59
|
+
@obj.unstub!(:foo)
|
60
|
+
|
61
|
+
@obj.foo.should == :a_result
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should have unstub as an alias of unstub!" do
|
65
|
+
@obj.stub!(:foo).and_return :bar
|
66
|
+
|
67
|
+
@obj.unstub(:foo)
|
68
|
+
|
69
|
+
lambda {
|
70
|
+
@obj.foo
|
71
|
+
}.should raise_error(NoMethodError)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should raise a MockExpectationError if it is not stubbed" do
|
75
|
+
lambda {
|
76
|
+
@obj.unstub!(:foo)
|
77
|
+
}.should raise_error(MockExpectationError, "The method `foo` was not stubbed or was already unstubbed")
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should raise a MockExpectationError if it was already unstubbed" do
|
81
|
+
@obj.stub!(:foo)
|
82
|
+
@obj.unstub!(:foo)
|
83
|
+
|
84
|
+
lambda {
|
85
|
+
@obj.unstub!(:foo)
|
86
|
+
}.should raise_error(MockExpectationError, "The method `foo` was not stubbed or was already unstubbed")
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should use the correct message name in the error" do
|
90
|
+
@obj.stub!(:bar)
|
91
|
+
@obj.unstub!(:bar)
|
92
|
+
|
93
|
+
lambda {
|
94
|
+
@obj.unstub!(:bar)
|
95
|
+
}.should raise_error(MockExpectationError, "The method `bar` was not stubbed or was already unstubbed")
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should raise a MockExpectationError if the method is defined, but not stubbed" do
|
99
|
+
def @obj.meth; end
|
100
|
+
|
101
|
+
lambda {
|
102
|
+
@obj.unstub!(:meth)
|
103
|
+
}.should raise_error(MockExpectationError)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should be able to restub a after unstubbing" do
|
107
|
+
@obj.stub!(:foo).and_return :bar
|
108
|
+
|
109
|
+
@obj.unstub!(:foo)
|
110
|
+
|
111
|
+
@obj.stub!(:foo).and_return :baz
|
112
|
+
|
113
|
+
@obj.foo.should == :baz
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should remove only the first stub if multiple stubs have been defined" do
|
117
|
+
@obj.stub!(:foo).and_return :first
|
118
|
+
@obj.stub!(:foo).and_return :second
|
119
|
+
|
120
|
+
@obj.unstub!(:foo)
|
121
|
+
|
122
|
+
@obj.foo.should == :first
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -255,7 +255,8 @@ a {
|
|
255
255
|
<div class="failure" id="failure_5">
|
256
256
|
<div class="message"><pre>expected: "RSpec is a\nbehaviour driven development\nframework for Ruby\n",
|
257
257
|
got: "RSpec is a\nbehavior driven development\nframework for Ruby\n" (using ==)
|
258
|
-
|
258
|
+
|
259
|
+
Diff:
|
259
260
|
@@ -1,4 +1,4 @@
|
260
261
|
RSpec is a
|
261
262
|
-behavior driven development
|
@@ -259,7 +259,8 @@ a {
|
|
259
259
|
<div class="failure" id="failure_5">
|
260
260
|
<div class="message"><pre>expected: "RSpec is a\nbehaviour driven development\nframework for Ruby\n",
|
261
261
|
got: "RSpec is a\nbehavior driven development\nframework for Ruby\n" (using ==)
|
262
|
-
|
262
|
+
|
263
|
+
Diff:
|
263
264
|
@@ -1,4 +1,4 @@
|
264
265
|
RSpec is a
|
265
266
|
-behavior driven development
|
@@ -265,7 +265,8 @@ a {
|
|
265
265
|
<div class="failure" id="failure_5">
|
266
266
|
<div class="message"><pre>expected: "RSpec is a\nbehaviour driven development\nframework for Ruby\n",
|
267
267
|
got: "RSpec is a\nbehavior driven development\nframework for Ruby\n" (using ==)
|
268
|
-
|
268
|
+
|
269
|
+
Diff:
|
269
270
|
@@ -1,4 +1,4 @@
|
270
271
|
RSpec is a
|
271
272
|
-behaviour driven development
|
@@ -265,7 +265,8 @@ a {
|
|
265
265
|
<div class="failure" id="failure_5">
|
266
266
|
<div class="message"><pre>expected: "RSpec is a\nbehaviour driven development\nframework for Ruby\n",
|
267
267
|
got: "RSpec is a\nbehavior driven development\nframework for Ruby\n" (using ==)
|
268
|
-
|
268
|
+
|
269
|
+
Diff:
|
269
270
|
@@ -1,4 +1,4 @@
|
270
271
|
RSpec is a
|
271
272
|
-behaviour driven development
|
@@ -270,7 +270,8 @@ a {
|
|
270
270
|
<div class="failure" id="failure_5">
|
271
271
|
<div class="message"><pre>expected: "RSpec is a\nbehaviour driven development\nframework for Ruby\n",
|
272
272
|
got: "RSpec is a\nbehavior driven development\nframework for Ruby\n" (using ==)
|
273
|
-
|
273
|
+
|
274
|
+
Diff:
|
274
275
|
@@ -1,4 +1,4 @@
|
275
276
|
RSpec is a
|
276
277
|
-behaviour driven development
|
@@ -255,7 +255,8 @@ a {
|
|
255
255
|
<div class="failure" id="failure_5">
|
256
256
|
<div class="message"><pre>expected: "RSpec is a\nbehaviour driven development\nframework for Ruby\n",
|
257
257
|
got: "RSpec is a\nbehavior driven development\nframework for Ruby\n" (using ==)
|
258
|
-
|
258
|
+
|
259
|
+
Diff:
|
259
260
|
@@ -1,4 +1,4 @@
|
260
261
|
RSpec is a
|
261
262
|
-behavior driven development
|
@@ -261,7 +261,8 @@ a {
|
|
261
261
|
<div class="failure" id="failure_5">
|
262
262
|
<div class="message"><pre>expected: "RSpec is a\nbehaviour driven development\nframework for Ruby\n",
|
263
263
|
got: "RSpec is a\nbehavior driven development\nframework for Ruby\n" (using ==)
|
264
|
-
|
264
|
+
|
265
|
+
Diff:
|
265
266
|
@@ -1,4 +1,4 @@
|
266
267
|
RSpec is a
|
267
268
|
-behaviour driven development
|
@@ -261,7 +261,8 @@ a {
|
|
261
261
|
<div class="failure" id="failure_5">
|
262
262
|
<div class="message"><pre>expected: "RSpec is a\nbehaviour driven development\nframework for Ruby\n",
|
263
263
|
got: "RSpec is a\nbehavior driven development\nframework for Ruby\n" (using ==)
|
264
|
-
|
264
|
+
|
265
|
+
Diff:
|
265
266
|
@@ -1,4 +1,4 @@
|
266
267
|
RSpec is a
|
267
268
|
-behaviour driven development
|
@@ -266,7 +266,8 @@ a {
|
|
266
266
|
<div class="failure" id="failure_5">
|
267
267
|
<div class="message"><pre>expected: "RSpec is a\nbehaviour driven development\nframework for Ruby\n",
|
268
268
|
got: "RSpec is a\nbehavior driven development\nframework for Ruby\n" (using ==)
|
269
|
-
|
269
|
+
|
270
|
+
Diff:
|
270
271
|
@@ -1,4 +1,4 @@
|
271
272
|
RSpec is a
|
272
273
|
-behaviour driven development
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RSpec Development Team
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-07-16 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.1
|
33
|
+
version: 2.3.1
|
34
34
|
version:
|
35
35
|
description: Behaviour Driven Development for Ruby.
|
36
36
|
email:
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- features/example_groups/example_group_with_should_methods.feature
|
112
112
|
- features/example_groups/implicit_docstrings.feature
|
113
113
|
- features/example_groups/nested_groups.feature
|
114
|
+
- features/expectations/customized_message.feature
|
114
115
|
- features/expectations/expect_change.feature
|
115
116
|
- features/expectations/expect_error.feature
|
116
117
|
- features/extensions/custom_example_group.feature
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- features/matchers/define_diffable_matcher.feature
|
124
125
|
- features/matchers/define_matcher.feature
|
125
126
|
- features/matchers/define_matcher_outside_rspec.feature
|
127
|
+
- features/matchers/define_matcher_with_fluent_interface.feature
|
126
128
|
- features/mock_framework_integration/use_flexmock.feature
|
127
129
|
- features/mock_framework_integration/use_mocha.feature
|
128
130
|
- features/mock_framework_integration/use_rr.feature
|
@@ -252,6 +254,7 @@ files:
|
|
252
254
|
- lib/spec/runner/option_parser.rb
|
253
255
|
- lib/spec/runner/options.rb
|
254
256
|
- lib/spec/runner/reporter.rb
|
257
|
+
- lib/spec/stubs/cucumber.rb
|
255
258
|
- lib/spec/test/unit.rb
|
256
259
|
- lib/spec/version.rb
|
257
260
|
- resources/helpers/cmdline.rb
|
@@ -285,7 +288,7 @@ files:
|
|
285
288
|
- spec/spec/example/subclassing_example_group_spec.rb
|
286
289
|
- spec/spec/example/subject_spec.rb
|
287
290
|
- spec/spec/expectations/differs/default_spec.rb
|
288
|
-
- spec/spec/expectations/extensions/
|
291
|
+
- spec/spec/expectations/extensions/kernel_spec.rb
|
289
292
|
- spec/spec/expectations/fail_with_spec.rb
|
290
293
|
- spec/spec/expectations/handler_spec.rb
|
291
294
|
- spec/spec/expectations/wrap_expectation_spec.rb
|
@@ -362,6 +365,7 @@ files:
|
|
362
365
|
- spec/spec/mocks/stub_spec.rb
|
363
366
|
- spec/spec/mocks/stubbed_message_expectations_spec.rb
|
364
367
|
- spec/spec/mocks/twice_counts_spec.rb
|
368
|
+
- spec/spec/mocks/unstub_spec.rb
|
365
369
|
- spec/spec/package/bin_spec_spec.rb
|
366
370
|
- spec/spec/rake/spectask_spec.rb
|
367
371
|
- spec/spec/runner/class_and_argument_parser_spec.rb
|
@@ -425,7 +429,7 @@ licenses: []
|
|
425
429
|
post_install_message: |
|
426
430
|
**************************************************
|
427
431
|
|
428
|
-
Thank you for installing rspec-1.2.
|
432
|
+
Thank you for installing rspec-1.2.8
|
429
433
|
|
430
434
|
Please be sure to read History.rdoc and Upgrade.rdoc
|
431
435
|
for useful information about this release.
|
@@ -455,6 +459,6 @@ rubyforge_project: rspec
|
|
455
459
|
rubygems_version: 1.3.4
|
456
460
|
signing_key:
|
457
461
|
specification_version: 3
|
458
|
-
summary: rspec 1.2.
|
462
|
+
summary: rspec 1.2.8
|
459
463
|
test_files: []
|
460
464
|
|