test/test_proxy.rb in muack-1.4.0 vs test/test_proxy.rb in muack-1.5.0
- old
+ new
@@ -51,20 +51,35 @@
mock(Obj).aloha
Obj.aloha(*args).should.eq args
Obj.aloha.should.eq [0, 1]
end
+ would 'proxy and call the original method for keyargs' do
+ mock(Obj).bonjour(a: :b, b: :a)
+ mock(Obj).bonjour
+ Obj.bonjour(a: :b, b: :a).should.eq %i[b a]
+ Obj.bonjour.should.eq [0, 1]
+ end
+
+ would 'proxy and call the original method for fake keyargs' do
+ args = {a: :b, b: :a}
+ mock(Obj).ciao(args)
+ mock(Obj).ciao
+ Obj.ciao(args).should.eq %i[b a]
+ Obj.ciao.should.eq [0, 1]
+ end
+
would 'proxy and call the block with super' do
mock(Str).class.peek_return{ |k| k.name.reverse }
Str.class.should.eq 'gnirtS'
end
would 'mock proxy and call, mock proxy and call' do
mock(Obj).class.peek_return{ |k| k.name.reverse }
- Obj.class.should.eq 'tcejbO'
+ Obj.class.should.eq 'slC'
mock(Obj).class.peek_return{ |k| k.name.upcase }
- Obj.class.should.eq 'OBJECT'
+ Obj.class.should.eq 'CLS'
end
would 'stub proxy and call, stub proxy and call' do
stub(Obj).kind_of?(Object).peek_return{ |b| !b }
Obj.kind_of?(Object).should.eq false
@@ -72,15 +87,15 @@
Obj.kind_of?(String).should.eq 'false'
end
would 'stub proxy with any times' do
stub(Obj).class.peek_return{ |k| k.name.downcase }
- 3.times{ Obj.class.should.eq 'object' }
+ 3.times{ Obj.class.should.eq 'cls' }
end
would 'stub proxy and spy' do
stub(Obj).class.peek_return{ |k| k.name.downcase }
- Obj.class.should.eq 'object'
+ Obj.class.should.eq 'cls'
spy(Obj).class
end
end
describe 'Muack.verify==false' do