Sha256: 43717f6d906f7d02ce4120c68c492d6d8e4c76398b776b244c02144d3b31faf4

Contents?: true

Size: 1.13 KB

Versions: 22

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe 'Create Account' do

  integration_test do

    let(:account) do
      Z::Account.new name: 'Joe Customer',
                     currency: Tenant.currency,
                     bill_cycle_day: '1'
    end

    after(:each) do
      account.delete unless account.new_record?
    end

    it 'can create an account' do
      expect(account).to be_a_new_record
      expect(account).to_not be_valid
      expect(account.id).to_not be_present
      expect(account.errors.full_messages).to eq ["Status can't be blank"]

      now 'update account to be valid' do
        account.status = 'Draft'
        expect(account).to be_valid
        expect(account.errors.full_messages).to be_empty
      end

      now 'save the account' do
        expect(account.save).to be true
        expect(account.id).to be_present
        expect(account.errors.full_messages).to eq []
      end

      now 'ensure error messages are accessible' do
        expect(account.update_attributes status: 'Active').to be false
        expect(account.errors.full_messages).to eq ['Active account must have both sold to and bill to.']
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
active_zuora-2.1.2 spec/account_integration_spec.rb
active_zuora-2.1.1 spec/account_integration_spec.rb