Sha256: 453dfaff5b24e32c11e2819a5883daa259fd192cea967320bcdf09f36fb84313

Contents?: true

Size: 1.48 KB

Versions: 10

Compression:

Stored size: 1.48 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, FakeWeb.last_request.body
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shopify_api-7.0.2 test/collection_publication_test.rb
shopify_api-7.0.1 test/collection_publication_test.rb
shopify_api-7.0.0 test/collection_publication_test.rb
shopify_api-6.0.0 test/collection_publication_test.rb
shopify_api-5.2.4 test/collection_publication_test.rb
shopify_api-5.2.3 test/collection_publication_test.rb
shopify_api-5.2.2 test/collection_publication_test.rb
shopify_api-5.2.1 test/collection_publication_test.rb
shopify_api-5.2.0 test/collection_publication_test.rb
shopify_api-5.1.0 test/collection_publication_test.rb