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-5.2.0 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-5.1.2 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-5.1.1 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-5.1.0 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-5.0.1 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-5.0.0 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-4.1.1 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-4.1.0 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-4.0.0 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-3.1.1 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-3.1.0 spec/models/openstax/accounts/account_spec.rb
openstax_accounts-3.0.0 spec/models/openstax/accounts/account_spec.rb