spec/mongoid/attributes/readonly_spec.rb in mongoid-3.1.7 vs spec/mongoid/attributes/readonly_spec.rb in mongoid-4.0.0.alpha1

- old
+ new

@@ -13,22 +13,22 @@ before do Person.attr_readonly :title end it "adds the field to readonly attributes" do - Person.readonly_attributes.to_a.should eq([ "title" ]) + expect(Person.readonly_attributes.to_a).to eq([ "title" ]) end end context "when providing multiple fields" do before do Person.attr_readonly :title, :terms end it "adds the fields to readonly attributes" do - Person.readonly_attributes.to_a.should eq([ "title", "terms" ]) + expect(Person.readonly_attributes.to_a).to eq([ "title", "terms" ]) end end context "when creating a new document with a readonly field" do @@ -39,23 +39,23 @@ let(:person) do Person.create(title: "sir", terms: true) end it "sets the first readonly value" do - person.title.should eq("sir") + expect(person.title).to eq("sir") end it "sets subsequent readonly values" do - person.terms.should be_true + expect(person.terms).to be true end it "persists the first readonly value" do - person.reload.title.should eq("sir") + expect(person.reload.title).to eq("sir") end it "persists subsequent readonly values" do - person.reload.terms.should be_true + expect(person.reload.terms).to be true end end context "when updating an existing readonly field" do @@ -73,15 +73,15 @@ person.title = "mr" person.save end it "does not update the field" do - person.title.should eq("sir") + expect(person.title).to eq("sir") end it "does not persist the changes" do - person.reload.title.should eq("sir") + expect(person.reload.title).to eq("sir") end end context "when updating via []=" do @@ -89,15 +89,15 @@ person[:title] = "mr" person.save end it "does not update the field" do - person.title.should eq("sir") + expect(person.title).to eq("sir") end it "does not persist the changes" do - person.reload.title.should eq("sir") + expect(person.reload.title).to eq("sir") end end context "when updating via write_attribute" do @@ -105,15 +105,15 @@ person.write_attribute(:title, "mr") person.save end it "does not update the field" do - person.title.should eq("sir") + expect(person.title).to eq("sir") end it "does not persist the changes" do - person.reload.title.should eq("sir") + expect(person.reload.title).to eq("sir") end end context "when updating via update_attributes" do @@ -121,15 +121,15 @@ person.update_attributes(title: "mr") person.save end it "does not update the field" do - person.title.should eq("sir") + expect(person.title).to eq("sir") end it "does not persist the changes" do - person.reload.title.should eq("sir") + expect(person.reload.title).to eq("sir") end end context "when updating via update_attributes!" do @@ -137,14 +137,14 @@ person.update_attributes!(title: "mr") person.save end it "does not update the field" do - person.title.should eq("sir") + expect(person.title).to eq("sir") end it "does not persist the changes" do - person.reload.title.should eq("sir") + expect(person.reload.title).to eq("sir") end end context "when updating via update_attribute" do