Sha256: d72399d1dc078000886b9d668dfd28d5c5d7c5f393838f533a5596bbf0c84080

Contents?: true

Size: 1.49 KB

Versions: 9

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true
require 'test_helper'

class CollectionPublicationTest < Test::Unit::TestCase
  def test_get_all_collection_publications
    fake('publications/55650051/collection_publications', body: load_fixture('collection_publications'))
    collection_publications = ShopifyAPI::CollectionPublication.find(:all, params: { publication_id: 55650051 })

    assert_equal(96062799894, collection_publications.first.id)
    assert_equal(55650051, collection_publications.first.publication_id)
  end

  def test_get_collection_publication
    fake('publications/55650051/collection_publications/647162527768', body: load_fixture('collection_publication'))
    collection_publication = ShopifyAPI::CollectionPublication.find(647162527768, params: { publication_id: 55650051 })

    assert_equal(96062799894, collection_publication.id)
    assert_equal(55650051, collection_publication.publication_id)
  end

  def test_create_collection_publication
    fake('publications/55650051/collection_publications', method: :post, body: load_fixture('collection_publication'))
    ShopifyAPI::CollectionPublication.create(
      publication_id: 55650051,
      published_at: "2018-01-29T14:06:08-05:00",
      published: true,
      collection_id: 8267093571
    )

    expected_body = {
      collection_publication: {
        published_at: "2018-01-29T14:06:08-05:00",
        published: true,
        collection_id: 8267093571,
      },
    }.to_json

    assert_equal(expected_body, WebMock.last_request.body)
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
shopify_api-9.5.2 test/collection_publication_test.rb
ruby_shopify_api-1.2.0 test/collection_publication_test.rb
ruby_shopify_api-1.1.0 test/collection_publication_test.rb
ruby_shopify_api-1.0.0 test/collection_publication_test.rb
shopify_api-9.5.1 test/collection_publication_test.rb
shopify_api-9.5 test/collection_publication_test.rb
shopify_api-9.4.1 test/collection_publication_test.rb
shopify_api-9.4.0 test/collection_publication_test.rb
shopify_api-9.3.0 test/collection_publication_test.rb