Sha256: e14ae08f9a5410bc4e253933a48a9a019e1d20a9b7940180576d3a077351988b

Contents?: true

Size: 1.4 KB

Versions: 21

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe 'accounts' do
  let(:client) {create_client}

  let(:account) {
    create_account(
      client: client, creator: client,
      account: {
        owner: create_user(client: client, creator: client)
      }.merge(details)
    )
  }

  describe '#type' do
    let(:details) {{type: 'oracle'}}

    it 'is the account type for the account' do
      expect(account.type).to eql('oracle')
    end
  end

  describe '#signup_via' do
    let(:details) {{signup_via: 'deis'}}

    it 'is the service through which the owner signed up' do
      expect(account.signup_via).to eql('deis')
    end
  end

  describe '#legacy_id' do
    let(:details) {{}}

    # Fun fact: we're not allowed to set legacy_id in create_account
    before(:each) do
      client.data[:accounts][account.id].merge!(
        {'legacy_id' => '19283'}
      )

      account.reload
    end

    it 'is the legacy_id for the account' do
      expect(account.legacy_id).to eql('19283')
    end
  end

  context 'when searched by legacy_id' do
    let(:details) {{}}
    let(:legacy_id) {Cistern::Mock.random_numbers(6)}
    let(:searched) {client.accounts.all(legacy_id: legacy_id)}

    before(:each) do
      client.data[:accounts][account.id].merge!(
        {'legacy_id' => legacy_id}
      )

      account.reload
    end

    it 'is a resounding success', mock_only: true do
      expect(searched).to include(account)
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
ey-core-3.6.0.autoscaling1 spec/account_spec.rb
ey-core-3.6.4 spec/account_spec.rb
ey-core-3.6.3 spec/account_spec.rb
ey-core-3.6.1 spec/account_spec.rb
groove-ey-core-3.6.3 spec/account_spec.rb
groove-ey-core-3.6.2 spec/account_spec.rb
groove-ey-core-3.6.1 spec/account_spec.rb
ey-core-3.5.0 spec/account_spec.rb
ey-core-3.4.4 spec/account_spec.rb
ey-core-3.4.2 spec/account_spec.rb
ey-core-3.4.1 spec/account_spec.rb
ey-core-3.4.0 spec/account_spec.rb
ey-core-3.3.1 spec/account_spec.rb
ey-core-3.3.0 spec/account_spec.rb
ey-core-3.2.6 spec/account_spec.rb
ey-core-3.2.5 spec/account_spec.rb
ey-core-3.2.4 spec/account_spec.rb
ey-core-3.2.3 spec/account_spec.rb
ey-core-3.2.2 spec/account_spec.rb
ey-core-3.2.1 spec/account_spec.rb