spec/push_spec.rb in agent-0.9.1 vs spec/push_spec.rb in agent-0.10.0

- old
+ new

@@ -27,11 +27,11 @@ sleep 0.2 @push.receive{|v|} s, _ = @ack.receive - (Time.now - s).should be_within(0.01).of(0) + (Time.now - s).should be_within(0.02).of(0) end it "should raise an error on the waiter when closed" do go!{ sleep 0.1; @push.close } lambda{ @push.wait }.should raise_error(Agent::Errors::ChannelClosed) @@ -39,9 +39,38 @@ it "be able to be gracefully rolled back" do @push.should_not be_sent @push.receive{|v| raise Agent::Errors::Rollback } @push.should_not be_sent + end + end + + context "marshaling" do + let(:object){ "foo" } + let(:skip_marshal){ false } + let(:push){ Agent::Push.new(object, :skip_marshal => skip_marshal) } + + it "makes a copy of the object" do + push.object.should == object + push.object.object_id.should_not == object.object_id + end + + context "with an object type that skips marshaling" do + let(:object){ ::Queue.new } + + it "does not make a copy of the object" do + push.object.should == object + push.object.object_id.should == object.object_id + end + end + + context "when skip_marshal is true" do + let(:skip_marshal){ true } + + it "does not make a copy of the object" do + push.object.should == object + push.object.object_id.should == object.object_id + end end end context "with a blocking_once" do before do