Sha256: 2a3c0f4460b6d7e098aa847fdb76954e4982516b82914a2002cd959ddcb86488

Contents?: true

Size: 732 Bytes

Versions: 45

Compression:

Stored size: 732 Bytes

Contents

describe "Prime::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

45 entries across 45 versions & 1 rubygems

Version Path
motion-prime-1.0.7 spec/unit/models/errors_spec.rb
motion-prime-1.0.6 spec/unit/models/errors_spec.rb
motion-prime-1.0.5 spec/unit/models/errors_spec.rb
motion-prime-1.0.4 spec/unit/models/errors_spec.rb
motion-prime-1.0.3 spec/unit/models/errors_spec.rb
motion-prime-1.0.2 spec/unit/models/errors_spec.rb
motion-prime-1.0.1 spec/unit/models/errors_spec.rb
motion-prime-1.0.0 spec/unit/models/errors_spec.rb
motion-prime-0.9.9.2 spec/unit/models/errors_spec.rb
motion-prime-0.9.9.1 spec/unit/models/errors_spec.rb
motion-prime-0.9.9 spec/unit/models/errors_spec.rb
motion-prime-0.9.8 spec/unit/models/errors_spec.rb
motion-prime-0.9.7 spec/unit/models/errors_spec.rb
motion-prime-0.9.6 spec/unit/models/errors_spec.rb
motion-prime-0.9.5 spec/unit/models/errors_spec.rb
motion-prime-0.9.4 spec/unit/models/errors_spec.rb
motion-prime-0.9.3 spec/unit/models/errors_spec.rb
motion-prime-0.9.2 spec/unit/models/errors_spec.rb
motion-prime-0.9.1 spec/unit/models/errors_spec.rb
motion-prime-0.9.0 spec/unit/models/errors_spec.rb