spec/receiver_spec.rb in gorillib-0.1.7 vs spec/receiver_spec.rb in gorillib-0.1.8
- old
+ new
@@ -1,6 +1,6 @@
-require File.dirname(__FILE__)+'/spec_helper.rb'
+require File.expand_path('spec_helper', File.dirname(__FILE__))
require 'gorillib/metaprogramming/class_attribute'
require 'gorillib/object/blank'
require 'time'
require 'date'
require 'gorillib/receiver'
@@ -74,17 +74,24 @@
@klass.should_receive(:new).with(:a, :b).and_return(obj)
obj.should_receive(:receive!).with({})
ret = @klass.receive(:a, :b, {})
end
- it 'accepts an empty arg set (receives an empty hash)' do
+ it 'accepts an empty arg set (as if it got an empty hash)' do
obj = mock
@klass.should_receive(:new).and_return(obj)
obj.should_receive(:receive!).with({})
- @klass.receive(nil)
+ @klass.receive()
end
+ it 'accepts an empty hash' do
+ obj = mock
+ @klass.should_receive(:new).and_return(obj)
+ obj.should_receive(:receive!).with({})
+ @klass.receive({})
+ end
+
it 'uses the *last* arg as the hsh to receive' do
obj = mock
hsh_to_receive = { :a => :b }
hsh_for_constructor = { :c => :d }
@klass.should_receive(:new).with(hsh_for_constructor).and_return(obj)
@@ -540,6 +547,5 @@
end
end
end
end
-