test/test_modifier.rb in muack-1.4.0 vs test/test_modifier.rb in muack-1.5.0
- old
+ new
@@ -35,23 +35,23 @@
end
end
describe 'peek_args' do
would 'with lexical scope' do
- str = 'ff'
+ str = String.new('ff')
stub(str).to_i.peek_args{16}
str.to_i.should.eq 255
end
would 'with dynamic scope' do
- str = '16'
+ str = String.new('16')
stub(str).to_i.peek_args(:instance_exec => true){Integer(self)}
str.to_i.should.eq 22
end
would 'modify' do
- str = 'ff'
+ str = String.new('ff')
stub(str).to_i(is_a(Integer)).peek_args{ |radix| radix * 2 }
str.to_i(8).should.eq 255
end
would 'preserve args' do
@@ -80,22 +80,22 @@
end
end
describe 'peek_return' do
would 'with lexical scope' do
- str = 'ff'
+ str = String.new('ff')
stub(str).to_i.peek_return{16}
str.to_i.should.eq 16
end
would 'with dynamic scope' do
- str = '16'
+ str = String.new('16')
stub(str).to_i.peek_return(:instance_exec => true){Integer(self)+1}
str.to_i.should.eq 17
end
would 'modify' do
- str = 'ff'
+ str = String.new('ff')
stub(str).to_i(is_a(Integer)).peek_return{ |result| result * 2 }
str.to_i(16).should.eq 510
end
end
end