Sha256: cc2daa57c0bfe58981021868b8ef1b11dbfad1d6acda25a74b05575f1f48041f
Contents?: true
Size: 839 Bytes
Versions: 3
Compression:
Stored size: 839 Bytes
Contents
require "spec_helper" describe Mongoid::Persistence::Atomic::Rename do describe "#rename" do context "when incrementing a field with a value" do let(:person) do Person.create(age: 100) end let!(:rename) do person.rename(:age, :years) end it "removes the old field" do person.age.should be_nil end it "adds the new field" do person.years.should eq(100) end it "returns the value" do rename.should eq(100) end it "resets the old dirty attributes" do person.changes["age"].should be_nil end it "resets the new field dirty attributes" do person.changes["years"].should be_nil end it "persists the changes" do person.reload.years.should eq(100) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongoid-3.1.7 | spec/mongoid/persistence/atomic/rename_spec.rb |
mongoid-3.1.6 | spec/mongoid/persistence/atomic/rename_spec.rb |
mongoid-3.1.5 | spec/mongoid/persistence/atomic/rename_spec.rb |