rr 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ 1.0.2
2
+ - Fixed Two calls recorded to a mock expecting only one call when called via another mock's yield block (http://github.com/btakita/rr/issues/closed#issue/42). Patch by Eugene Pimenov (http://github.com/libc).
3
+
4
+ 1.0.1
5
+ - Removed new_instance_of for Ruby 1.9.2 compatibility. instance_of is now an alias for any_instance_of.
6
+ - Compatible with Ruby 1.9.2
7
+
1
8
  1.0.0
2
9
  - Added any_instance_of (aliased by all_instances_of), which binds methods directly to the class (instead of the eigenclass).
3
10
  - Subclasses of a injected class do not have their methods overridden.
@@ -250,4 +257,4 @@
250
257
  - Rspec and Test::Unit integration fixes
251
258
 
252
259
  * 0.1.0
253
- - Initial Release
260
+ - Initial Release
data/README.rdoc CHANGED
@@ -363,6 +363,7 @@ If you have directly contributed to RR and I missed you in this list, please let
363
363
  * David Chelimsky for encouragement to make the RR framework, for developing the Rspec mock framework, syntax ideas, and patches
364
364
  * Daniel Sudol for identifing performance issues with RR
365
365
  * Dmitry Ratnikov for patches
366
+ * Eugene Pimenov for patches
366
367
  * Felix Morio for pairing with me
367
368
  * Gabriel Horner for patches
368
369
  * Gerard Meszaros for his excellent book "xUnit Test Patterns"
@@ -380,4 +381,5 @@ If you have directly contributed to RR and I missed you in this list, please let
380
381
  * Phil Darnowsky for patches
381
382
  * Pivotal Labs for sponsoring RR development
382
383
  * Stephen Baker for Developing Rspec
383
- * Tatsuya Ono for patches
384
+ * Tatsuya Ono for patches
385
+ * Tuomas Kareinen for a bug report
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :minor: 0
3
- :patch: 1
3
+ :patch: 2
4
4
  :major: 1
5
5
  :build:
@@ -16,7 +16,6 @@ module RR
16
16
  if Injections::DoubleInjection.exists?(subject_class, method_name)
17
17
  @double = find_double_to_attempt
18
18
  if double
19
- call_yields
20
19
  return_value = extract_subject_from_return_value(call_implementation)
21
20
  if after_call_proc
22
21
  extract_subject_from_return_value(after_call_proc.call(return_value))
@@ -156,6 +156,16 @@ describe "mock" do
156
156
  end.should raise_error(RR::Errors::DoubleNotFoundError)
157
157
  end
158
158
 
159
+ it "expects a method call to a mock via another mock's block yield only once" do
160
+ cage = Object.new
161
+ cat = Object.new
162
+ mock(cat).miau # should be expected to be called only once
163
+ mock(cage).find_cat.yields(cat)
164
+ mock(cage).cats
165
+ cage.find_cat { |c| c.miau }
166
+ cage.cats
167
+ end
168
+
159
169
  describe "on class method" do
160
170
  class SampleClass1
161
171
  def self.hello; "hello!"; end
@@ -123,4 +123,30 @@ describe "stub" do
123
123
  subject.foobar(4).should == :baz
124
124
  end
125
125
  end
126
+
127
+ context "stub that yields" do
128
+ context "when yields called without any arguments" do
129
+ it "yields only once" do
130
+ called_from_block = mock!.foo.once.subject
131
+ block_caller = stub!.bar.yields.subject
132
+ block_caller.bar { called_from_block.foo }
133
+ end
134
+ end
135
+
136
+ context "when yields called with an argument" do
137
+ it "yields only once" do
138
+ called_from_block = mock!.foo(1).once.subject
139
+ block_caller = stub!.bar.yields(1).subject
140
+ block_caller.bar { |argument| called_from_block.foo(argument) }
141
+ end
142
+ end
143
+
144
+ context "when yields calls are chained" do
145
+ it "yields several times" do
146
+ called_from_block = mock!.foo(1).once.then.foo(2).once.subject
147
+ block_caller = stub!.bar.yields(1).yields(2).subject
148
+ block_caller.bar { |argument| called_from_block.foo(argument) }
149
+ end
150
+ end
151
+ end
126
152
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rr
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Takita
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-30 00:00:00 -07:00
18
+ date: 2010-11-01 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21