Sha256: 98525bc111bf63b28bcec2f9342dcd1c0a6dc18f0776d9b97f981dfa9e908983

Contents?: true

Size: 725 Bytes

Versions: 10

Compression:

Stored size: 725 Bytes

Contents

describe "Model Errors" do
  before do
    MotionPrime::Store.connect
    @user = stub_user("Bob", 10, Time.now)
  end

  describe "#errors" do
    it "should be blank on initialize" do
      @user.errors.blank?.should == true
    end

    it "should not be blank after adding error" do
      @user.errors.add(:name, 'bar')
      @user.errors.blank?.should == false
    end

    it "should not present after reset" do
      @user.errors.add(:name, 'bar')
      @user.errors.present?.should == true
      @user.errors.reset
      @user.errors.present?.should == false
    end

    it "should be convertable to string" do
      @user.errors.add(:name, 'bar')
      @user.errors.to_s.match(/bar/).should != nil
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
motion-prime-0.4.5 spec/models/errors_spec.rb
motion-prime-0.4.4 spec/models/errors_spec.rb
motion-prime-0.4.3 spec/models/errors_spec.rb
motion-prime-0.4.2 spec/models/errors_spec.rb
motion-prime-0.4.1 spec/models/errors_spec.rb
motion-prime-0.4.0 spec/models/errors_spec.rb
motion-prime-0.3.3 spec/models/errors_spec.rb
motion-prime-0.3.2 spec/models/errors_spec.rb
motion-prime-0.3.1 spec/models/errors_spec.rb
motion-prime-0.3.0 spec/models/errors_spec.rb