spec/once_spec.rb in agent-0.10.0 vs spec/once_spec.rb in agent-0.11.0

- old
+ new

@@ -11,12 +11,12 @@ @once.perform do r << 1 end - r.size.should == 1 - r.first.should == 1 + expect(r.size).to eq(1) + expect(r.first).to eq(1) end it "should only execute the first block passed to it" do r = [] @@ -26,31 +26,31 @@ @once.perform do r << 2 end - r.size.should == 1 - r.first.should == 1 + expect(r.size).to eq(1) + expect(r.first).to eq(1) end it "should return the value returned from the block" do value, error = @once.perform do 1 end - value.should == 1 + expect(value).to eq(1) end it "should return nil for value and an error if it has already been used" do value, error = @once.perform{ 1 } - value.should == 1 - error.should be_nil + expect(value).to eq(1) + expect(error).to be_nil value, error = @once.perform{ 2 } - value.should be_nil - error.should_not be_nil - error.should be_message("already performed") + expect(value).to be_nil + expect(error).not_to be_nil + expect(error).to be_message("already performed") end it "should have minimal contention between threads when they contend for position" do r, s = [], Time.now.to_f @@ -79,12 +79,12 @@ mutex.synchronize{ condition.broadcast } # wait for the finished channel to be completed 2.times{ finished_channel.receive } - r.size.should == 1 - # Onlt the first sleep should be performed, so things should quickly - (Time.now.to_f - s).should be_within(0.05).of(0.15) + expect(r.size).to eq(1) + # Only the first sleep should be performed, so things should happen quickly + expect(Time.now.to_f - s).to be_within(0.05).of(0.15) waiting_channel.close finished_channel.close end end