Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Matt Scriven
committed
Jan 9, 2017
1 parent
44a572e
commit d65ece3
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module ShopifyAPI | ||
class CollectionListing < Base | ||
init_prefix :application | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'test_helper' | ||
|
||
class CollectionListingTest < Test::Unit::TestCase | ||
|
||
def test_get_collection_listings | ||
fake "applications/999/collection_listings", method: :get, status: 201, body: load_fixture('collection_listings') | ||
|
||
collection_listings = ShopifyAPI::CollectionListing.find(:all, params: { application_id: 999 }) | ||
|
||
assert_equal 1, collection_listings.count | ||
assert_equal 1, collection_listings.first.collection_id | ||
assert_equal 'Home page', collection_listings.first.title | ||
end | ||
|
||
# def test_get_collection_listing_for_collection_id | ||
# fake "applications/999/collection_listings/2", method: :get, status: 201, body: load_fixture('collection_listing') | ||
|
||
# collection_listing = ShopifyAPI::CollectionListing.find(2, params: { application_id: 999 }) | ||
|
||
# assert_equal 'Synergistic Silk Chair', collection_listing.title | ||
# end | ||
|
||
# def test_get_collection_listing_product_ids | ||
# fake "applications/999/collection_listings/product_ids", method: :get, status: 201, body: load_fixture('collection_listing_product_ids') | ||
|
||
# product_ids = ShopifyAPI::CollectionListing.product_ids(params: { application_id: 999 }) | ||
|
||
# assert_equal 2, product_ids.count | ||
# assert_equal 2, product_ids.first | ||
# assert_equal 1, product_ids.last | ||
# end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[ | ||
{ | ||
"collection_id": 1, | ||
"updated_at": "2017-01-09T13:59:09-05:00", | ||
"body_html": null, | ||
"default_product_image": null, | ||
"handle": "frontpage", | ||
"image": null, | ||
"title": "Home page", | ||
"sort_order": "alpha-asc", | ||
"published_at": "2017-01-09T13:59:09-05:00" | ||
} | ||
] |