Skip to content

Commit d76b1b5

Browse files
committed
Simplify with a mock
1 parent 46b3cf8 commit d76b1b5

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

spec/ruby/library/socket/basicsocket/send_spec.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,8 @@
101101

102102
describe 'with an object implementing #to_str' do
103103
it 'returns the amount of sent bytes' do
104-
data = Class.new do
105-
def to_str
106-
'hello'
107-
end
108-
end.new
104+
data = mock('message')
105+
data.should_receive(:to_str).and_return('hello')
109106
@client.send(data, 0, @server.getsockname).should == 5
110107
end
111108
end

0 commit comments

Comments
 (0)