Sha256: befd37480115d4f81b6ef2a3aa000d2c6425098a58114dd344efddcc3c1e00b0
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
require 'spec_helper' describe ShopifyAPI::Mock::Fixtures do describe "#all" do it "should return an array" do ShopifyAPI::Mock::Fixtures.all.should be_kind_of Array end end context "when given a valid fixture name" do it "should return the contents of a fixture" do @json = read_fixture :test ShopifyAPI::Mock::Fixtures.read(:test).should eq @json end end context "when given an invalid fixture name" do it "should raise an error" do expect { ShopifyAPI::Mock::Fixtures.read(:brown_chicken_brown_cow) }.should raise_error end end context "custom fixtures" do before { @json = '{ "count": 10 }' } describe "#use" do context "with custom fixture for content" do it "should override default fixture" do ShopifyAPI::Mock::Fixtures.read(:orders).should eq read_fixture :orders ShopifyAPI::Mock::Fixtures.use :count, @json ShopifyAPI::Mock::Fixtures.read(:count).should eq @json end end context "with :default for content" do it "should reset back to default fixture" do ShopifyAPI::Mock::Fixtures.use :count, @json ShopifyAPI::Mock::Fixtures.read(:count).should eq @json ShopifyAPI::Mock::Fixtures.use :count, :default ShopifyAPI::Mock::Fixtures.read(:orders).should eq read_fixture :orders end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shopify-mock-0.0.3 | spec/fixtures_spec.rb |
shopify-mock-0.0.2 | spec/fixtures_spec.rb |