Sha256: 3a900ceabe24f4aa85faba94035529f694ece4aa67d9bc0a3bcfd98bc6c70f71

Contents?: true

Size: 877 Bytes

Versions: 4

Compression:

Stored size: 877 Bytes

Contents

require 'test_helper'

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

  let(:adapter)       { @client.Product }
  let(:plural_name)   { 'products' }
  let(:record_class)  { Gecko::Record::Product }

  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

4 entries across 4 versions & 1 rubygems

Version Path
gecko-ruby-0.0.7 test/record/product_adapter_test.rb
gecko-ruby-0.0.6 test/record/product_adapter_test.rb
gecko-ruby-0.0.5 test/record/product_adapter_test.rb
gecko-ruby-0.0.4 test/record/product_adapter_test.rb