Sha256: 38baa0603dcae5c5c32c54bbeb69a2015b8c47139ce34a2a6c70d62db16d24e7

Contents?: true

Size: 722 Bytes

Versions: 32

Compression:

Stored size: 722 Bytes

Contents

require 'spec_helper'

module OpenStax::Accounts
  describe Account do
    context 'validation' do
      it 'requires a unique openstax_uid' do
        account = FactoryGirl.build(:openstax_accounts_account, openstax_uid: nil)
        expect(account).not_to be_valid
        expect(account.errors[:openstax_uid]).to eq(['can\'t be blank'])

        account.openstax_uid = 1
        account.save!

        account_2 = FactoryGirl.build(:openstax_accounts_account, openstax_uid: 1)
        expect(account_2).not_to be_valid
        expect(account_2.errors[:openstax_uid]).to eq(['has already been taken'])
      end
    end

    it 'is not anonymous' do
      expect(Account.new.is_anonymous?).to eq false
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
openstax_accounts-7.2.0 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-7.1.0 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-7.0.1 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-7.0.0 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.4.2 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.4.1 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.4.0 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.3.2 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.3.1 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.3.0 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.2.0 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.1.7 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.1.6 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.1.5 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.1.4 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.1.3 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.1.2 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.1.1 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.1.0 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-6.0.0 spec/models/openstax/accounts/account_spec.rb