spec/lib/hybag/ingester_spec.rb in hybag-0.1.1 vs spec/lib/hybag/ingester_spec.rb in hybag-0.2.0

- old
+ new

@@ -85,16 +85,24 @@ let(:built_model) {subject.ingest} it "should populate datastreams" do Array.wrap(built_model.title).first.should == "Mexican workers" end it "should populate file datastreams" do - built_model.content.content.should == File.read(File.join(bag.data_dir,"content.png")) + built_model.content.content.should == File.open(File.join(bag.data_dir, 'content.png'), 'rb').read end it "should be new" do expect(built_model).to be_new end it "should not be persisted" do expect(built_model).not_to be_persisted + end + context "when old_subject has been set" do + before(:each) do + subject.old_subject = "http://oregondigital.org/resource/oregondigital:1" + end + it "should only replace those subjects" do + expect(built_model.title.first).to eq "Test Title" + end end context "when there is a file datastream and no matching datastream defined" do before(:each) do # Add the hydra.png from fixture FakeFS.deactivate!