Sha256: ecd6526267d1219b0fff117ef4be3ecb785d43b40f69c243802bc85053d55a6c

Contents?: true

Size: 962 Bytes

Versions: 17

Compression:

Stored size: 962 Bytes

Contents

require 'test_helper'

class Gecko::Record::ProductAdapterTest < Minitest::Test
  include TestingAdapter
  include SharedAdapterExamples
  include SharedSideloadedDataParsingExamples

  let(:adapter)       { @client.Product }
  let(:plural_name)   { 'products' }
  let(:record_class)  { Gecko::Record::Product }
  let(:children)      { ["variants"] }

  def test_initializes_adapter
    assert_instance_of(Gecko::Record::ProductAdapter, @client.Product)
  end

  def test_saves_new_record
    VCR.use_cassette(plural_name + '_new_valid') do
      record = adapter.build(name: 'Gary')
      assert record.save
      assert record.id
      assert adapter.has_record_for_id?(record.id)
    end
  end

  def test_invalid_new_record
    VCR.use_cassette(plural_name + '_new_invalid') do
      record = adapter.build(product_type: 'Gecko')
      assert !record.save
      assert !record.id
      assert_equal record.errors[:name], ["can't be blank"]
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
gecko-ruby-0.9.1 test/record/product_adapter_test.rb
gecko-ruby-0.9.0 test/record/product_adapter_test.rb
gecko-ruby-0.8.0 test/record/product_adapter_test.rb
gecko-ruby-0.2.6 test/record/product_adapter_test.rb
gecko-ruby-0.7.1 test/record/product_adapter_test.rb
gecko-ruby-0.7.0 test/record/product_adapter_test.rb
gecko-ruby-0.6.0 test/record/product_adapter_test.rb
gecko-ruby-0.5.0 test/record/product_adapter_test.rb
gecko-ruby-0.2.5 test/record/product_adapter_test.rb
gecko-ruby-0.2.4 test/record/product_adapter_test.rb
gecko-ruby-0.2.3 test/record/product_adapter_test.rb
gecko-ruby-0.2.2 test/record/product_adapter_test.rb
gecko-ruby-0.2.0 test/record/product_adapter_test.rb
gecko-ruby-0.1.0 test/record/product_adapter_test.rb
gecko-ruby-0.0.10 test/record/product_adapter_test.rb
gecko-ruby-0.0.9 test/record/product_adapter_test.rb
gecko-ruby-0.0.8 test/record/product_adapter_test.rb