Sha256: 0fd7bb0b6bedbca24b98c52ee67e434d3ffa73a5a2ede077170c7e9ef7fb7fc6
Contents?: true
Size: 1.97 KB
Versions: 2
Compression:
Stored size: 1.97 KB
Contents
require 'spec_helper' describe ShopifyAPI::Mock::Fixture do describe "#new" do context "with invalid file name" do it "should raise IOError" do expect {ShopifyAPI::Mock::Fixture.new("invalid-file") }.should raise_error, IOError end end context "with valid file name" do before do @file_name = File.expand_path("../../lib/shopify-mock/fixtures/json/orders.json", __FILE__) @fixture = ShopifyAPI::Mock::Fixture.new(@file_name) end specify { @fixture.should be_a ShopifyAPI::Mock::Fixture } end end describe "class methods" do describe "#all" do before { @all = ShopifyAPI::Mock::Fixture.all } specify { @all.should be_kind_of Array } specify { @all.length.should > 0 } end describe "#find" do context "with a valid fixture name" do before { @result = ShopifyAPI::Mock::Fixture.find :orders, :json } specify { @result.should be_kind_of ShopifyAPI::Mock::Fixture } end context "with an invalid fixture name" do before { @result = ShopifyAPI::Mock::Fixture.find :brown_chicken_brown_cow, :xml } specify { @result.should be_nil } end end end describe "instance methods" do before(:all) do @fixture = ShopifyAPI::Mock::Fixture.find :orders, :json @original_data = @fixture.data end describe "#name" do specify { @fixture.name.should be_a Symbol } end describe "#ext" do specify { @fixture.ext.should be_a Symbol } end describe "#data" do specify { @fixture.data.should_not be_empty } end describe "#data=" do it "should override the original content" do @fixture.data.should eq @original_data @fixture.data = 'new' @fixture.data.should eq 'new' end it "should reset to original content when set to nil" do @fixture.data = nil @fixture.data.should eq @original_data end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
shopify-mock-new-0.1 | spec/fixture_spec.rb |
shopify-mock-0.1.2 | spec/fixture_spec.rb |