travishaynes / shopify-mock

Serves Shopify resources via FakeWeb for easily testing Shopify apps.
35 stars 23 forks source link

Added mock web responses for <object>/<id>.<json,xml> #4

Closed bunnymatic closed 13 years ago

bunnymatic commented 13 years ago

Hey there

I needed this mock to work when i did stuff like ShopifyAPI::Product.find( product_id )

To do that, i needed new fake web responses for product/product_id.json or .xml I've updated the gem to read all the fixture data and add those fake web responses based on the ids of the objects in the fixtures. I only focused on collections and only top level collections (for example: assets which have themes are parents are not included).

I also removed the failing test for assets (because it depends on a parent class theme) and replaced that test with a test for ShopifyAPI::Theme in your collections tests.

I've added tests for my additions. I also updated the README to mention the fact that this is now supported.

Hope this pull request makes it in.

Keep up the good work.

Cheers Mr Rogers (2rye.com)

travishaynes commented 13 years ago

Thanks! I see a few changes I'll make before I bundle it into the gem. I'll probably do that tomorrow.

bunnymatic commented 13 years ago

Great. We'll keep watching.

We may have to look into a little mock for the write side of things. Not sure yet, but if we do, we'll keep you posted.

Cheers Mr Rogers