Sha256: bedf63fde6681975ee8b2c4be82d9d3473b0c1ab813f6accbc5f4504bf924188

Contents?: true

Size: 836 Bytes

Versions: 15

Compression:

Stored size: 836 Bytes

Contents

require 'spec_helper'

describe ApiClient::Errors do
  describe '#add_errors' do
    before :each do
      @errors = ApiClient::Errors.new(self).add_errors({ :a => 'b' })
    end

    it 'should initialize a new object' do
      @errors[:a].should == 'b'
    end
  end

  describe '#unique_messages' do
    before :each do
      @user = User.new
      @user.valid?
    end

    it 'should set a unique message for each attribute' do
      @user.errors.unique_messages.should == { :a => "can't be blank and is not included in the list" }
    end
  end

  describe '#unique_message' do
    before :each do
      @user = User.new
      @user.valid?
    end

    it 'should return a unique message for the given attribute' do
      @user.errors.unique_message(:a).should == "can't be blank and is not included in the list"
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
api-client-3.1.0 spec/api-client/errors_spec.rb
api-client-3.0.0 spec/api-client/errors_spec.rb
api-client-2.7.0 spec/api-client/errors_spec.rb
api-client-2.6.0 spec/api-client/errors_spec.rb
api-client-2.5.0 spec/api-client/errors_spec.rb
api-client-2.5.0.rc1 spec/api-client/errors_spec.rb
api-client-2.4.0 spec/api-client/errors_spec.rb
api-client-2.3.0 spec/api-client/errors_spec.rb
api-client-2.2.0 spec/api-client/errors_spec.rb
api-client-2.1.0 spec/api-client/errors_spec.rb
api-client-2.0.3 spec/api-client/errors_spec.rb
api-client-2.0.2 spec/api-client/errors_spec.rb
api-client-2.0.1 spec/api-client/errors_spec.rb
api-client-2.0.0 spec/api-client/errors_spec.rb
api-client-2.0.0.rc2 spec/api-client/errors_spec.rb