better_receive 0.0.2 → 0.1.0
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/lib/better_receive/version.rb +1 -1
- data/lib/better_receive.rb +2 -1
- data/spec/lib/better_receive_spec.rb +4 -3
- metadata +1 -1
data/lib/better_receive.rb
CHANGED
@@ -2,7 +2,8 @@ require "better_receive/version"
|
|
2
2
|
|
3
3
|
module BetterReceive
|
4
4
|
def better_receive(method_name, *args, &block)
|
5
|
-
self.
|
5
|
+
self.should RSpec::Matchers::BuiltIn::RespondTo.new(method_name)
|
6
|
+
|
6
7
|
self.should_receive(method_name, *args, &block)
|
7
8
|
end
|
8
9
|
end
|
@@ -18,10 +18,11 @@ describe BetterReceive do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it "raises an error if it the method is not defined" do
|
21
|
-
foo.should_receive(:respond_to?).with(:baz).and_call_original
|
22
21
|
expect {
|
23
|
-
foo.better_receive(:
|
24
|
-
}.to raise_error
|
22
|
+
foo.better_receive(:bar_baz)
|
23
|
+
}.to raise_error(RSpec::Expectations::ExpectationNotMetError) { |error|
|
24
|
+
error.message.should =~ /to respond to :bar_baz/
|
25
|
+
}
|
25
26
|
end
|
26
27
|
|
27
28
|
it "checks that the object receives the specified method" do
|