Sha256: f6b7cae7a5a11de335a45c302d72cbd1182fefb67b1d5c7e54a62353cc647801

Contents?: true

Size: 669 Bytes

Versions: 13

Compression:

Stored size: 669 Bytes

Contents

describe MotionPrime::Model do
  before do
    MotionPrime::Store.connect
    @store = MotionPrime::Store.shared_store
  end

  after do
    @store.clear
  end

  describe "has_changed?" do
    before do
      @user = stub_user("Bob", 10, Time.now)
      @user.save
    end

    it "should be false after save" do
      @user.has_changed?.should.be.false
    end

    it "should be true after attribute change" do
      @user.name = "Smith"
      @user.has_changed?.should.be.true
    end

    it "should be false after reload" do
      @user.name = "Smith"
      @user.reload
      @user.has_changed?.should.be.false
      @user.name.should == "Bob"
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
motion-prime-1.0.7 spec/unit/models/dirty_spec.rb
motion-prime-1.0.6 spec/unit/models/dirty_spec.rb
motion-prime-1.0.5 spec/unit/models/dirty_spec.rb
motion-prime-1.0.4 spec/unit/models/dirty_spec.rb
motion-prime-1.0.3 spec/unit/models/dirty_spec.rb
motion-prime-1.0.2 spec/unit/models/dirty_spec.rb
motion-prime-1.0.1 spec/unit/models/dirty_spec.rb
motion-prime-1.0.0 spec/unit/models/dirty_spec.rb
motion-prime-0.9.9.2 spec/unit/models/dirty_spec.rb
motion-prime-0.9.9.1 spec/unit/models/dirty_spec.rb
motion-prime-0.9.9 spec/unit/models/dirty_spec.rb
motion-prime-0.9.8 spec/unit/models/dirty_spec.rb
motion-prime-0.9.7 spec/unit/models/dirty_spec.rb