Sha256: bb5d1233f0d6921064dcfddc1dc485197cc801a7ca670af187f17b079ba3df34

Contents?: true

Size: 1.3 KB

Versions: 11

Compression:

Stored size: 1.3 KB

Contents

require 'test_helper'
class Gecko::Record::AccountAdapterTest < Minitest::Test
  include TestingAdapter
  include SharedAdapterExamples
  undef :test_adapter_count
  undef :test_adapter_size

  # Can't build accounts via API
  undef :test_build
  undef :test_build_with_attributes
  undef :test_saving_new_record
  undef :test_saving_new_invalid_record
  undef :test_saving_record_with_idempotency_key

  let(:adapter)       { @client.Account }
  let(:plural_name)   { 'accounts' }
  let(:record_class)  { Gecko::Record::Account }

  def test_initializes_adapter
    assert_instance_of(Gecko::Record::AccountAdapter, @client.Account)
  end

  def test_current
    VCR.use_cassette('accounts#current') do
      assert_instance_of(Gecko::Record::Account, @client.Account.current)
      assert(@client.Account.current, 'Account.current is identity mapped')
    end
  end

  def test_adapter_all
    VCR.use_cassette(plural_name) do
      collection = adapter.where(limit: 5)
      assert_instance_of(Array, collection)
      assert_equal(1, collection.size)
      assert_instance_of(record_class, collection[0])
    end
  end

  def test_adapter_uses_identity_map
    VCR.use_cassette(plural_name) do
      collection = adapter.where(limit: 5)
      assert_equal(collection.first, adapter.find(collection.first.id))
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
gecko-ruby-0.9.1 test/record/account_adapter_test.rb
gecko-ruby-0.9.0 test/record/account_adapter_test.rb
gecko-ruby-0.8.0 test/record/account_adapter_test.rb
gecko-ruby-0.2.6 test/record/account_adapter_test.rb
gecko-ruby-0.7.1 test/record/account_adapter_test.rb
gecko-ruby-0.7.0 test/record/account_adapter_test.rb
gecko-ruby-0.6.0 test/record/account_adapter_test.rb
gecko-ruby-0.5.0 test/record/account_adapter_test.rb
gecko-ruby-0.2.5 test/record/account_adapter_test.rb
gecko-ruby-0.2.4 test/record/account_adapter_test.rb
gecko-ruby-0.2.3 test/record/account_adapter_test.rb