better_receive 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/better_receive.rb +2 -2
- data/lib/better_receive/version.rb +1 -1
- data/spec/lib/better_receive_spec.rb +13 -1
- metadata +2 -2
data/lib/better_receive.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require "better_receive/version"
|
2
2
|
|
3
3
|
module BetterReceive
|
4
|
-
def better_receive(method_name)
|
4
|
+
def better_receive(method_name, *args, &block)
|
5
5
|
self.respond_to?(method_name).should == true
|
6
|
-
self.should_receive(method_name)
|
6
|
+
self.should_receive(method_name, *args, &block)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
@@ -33,7 +33,7 @@ describe BetterReceive do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "returns an rspec mock object(responds to additional matchers ('with', 'once'...))" do
|
36
|
-
foo.better_receive(:bar)
|
36
|
+
foo.better_receive(:bar).should be_a RSpec::Mocks::MessageExpectation
|
37
37
|
|
38
38
|
foo.bar
|
39
39
|
|
@@ -41,5 +41,17 @@ describe BetterReceive do
|
|
41
41
|
|
42
42
|
foo.bar('wibble')
|
43
43
|
end
|
44
|
+
|
45
|
+
context "when passing arguments" do
|
46
|
+
it "passes all arguments through to should_receive" do
|
47
|
+
arg1 = 1
|
48
|
+
arg2 = 2
|
49
|
+
block = Proc.new {}
|
50
|
+
|
51
|
+
foo.should_receive(:should_receive).with(:bar, arg1, arg2, block)
|
52
|
+
|
53
|
+
foo.better_receive(:bar, arg1, arg2, block)
|
54
|
+
end
|
55
|
+
end
|
44
56
|
end
|
45
57
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_receive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-01-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|