spec/bitcoin/protocol/addr_spec.rb in bitcoin-ruby-0.0.5 vs spec/bitcoin/protocol/addr_spec.rb in bitcoin-ruby-0.0.6

- old
+ new

@@ -38,14 +38,16 @@ addr = Bitcoin::Protocol::Addr.new(@pkt) addr.values.should == [1305992491, 1, "82.83.222.4", 8333] end it 'initalize time, service and port' do - addr = Bitcoin::Protocol::Addr.new(nil) - t = Time.now.to_i; (t-10..t+10).include?(addr[:time]).should == true - addr[:service] .should == 1 - addr[:port] .should == Bitcoin.network[:default_port] - addr[:ip] .should == "127.0.0.1" + Time.freeze do + addr = Bitcoin::Protocol::Addr.new(nil) + addr[:time].should == Time.now.to_i + addr[:service] .should == 1 + addr[:port] .should == Bitcoin.network[:default_port] + addr[:ip] .should == "127.0.0.1" + end end it 'addr payload' do addr = Bitcoin::Protocol::Addr.new addr[:time] = 1305992491