test/test_proxy.rb in muack-1.0.0 vs test/test_proxy.rb in muack-1.0.1
- old
+ new
@@ -26,18 +26,32 @@
should 'proxy multiple times with super method' do
2.times{ mock(Str).class }
2.times{ Str.class.should.eq String }
end
+ should 'proxy with super method for multiple arguments' do
+ args = %w[o u]
+ mock(Str).tr(*args)
+ Str.tr(*args).should.eq 'Muu'
+ end
+
should 'return modifier itself for any modifier methods' do
mock(Str).to_s.peek_return{ |s| s.reverse }.times(2).
with_any_args.with_any_args
2.times{ Str.to_s.should.eq 'ooM' }
end
- should 'proxy and call the block' do
+ should 'proxy and call the original method' do
mock(Obj).method_missing(:inspect).peek_return{ |str| str.reverse }
Obj.inspect.should.eq 'jbo'
+ end
+
+ should 'proxy and call the original method for multiple arguments' do
+ args = %w[o u]
+ mock(Obj).aloha(*args)
+ mock(Obj).aloha
+ Obj.aloha(*args).should.eq args
+ Obj.aloha.should.eq [0, 1]
end
should 'proxy and call the block with super' do
mock(Str).class.peek_return{ |k| k.name.reverse }
Str.class.should.eq 'gnirtS'