Sha256: 1d9bd6070853b9909377d31f6c249e91cb80d27b754546b6a96443420e41a506

Contents?: true

Size: 878 Bytes

Versions: 30

Compression:

Stored size: 878 Bytes

Contents

require 'spec_helper'

describe Chargify::Product, :fake_resource do
  
  context '.find_by_handle' do
    let(:existing_product) { Chargify::Product.create(:id => 2, :handle => 'green-money') }

    before(:each) do
      FakeWeb.register_uri(:get, "#{test_domain}/products/lookup.xml?handle=#{existing_product.handle}", :body => existing_product.attributes.to_xml)
    end

    it 'finds the correct product by handle' do
      product = Chargify::Product.find_by_handle('green-money')
      product.should == existing_product
    end
    
    it 'is an instance of Chargify::Product' do
      product = Chargify::Product.find_by_handle('green-money')
      product.should be_instance_of(Chargify::Product)
    end  

    it 'is marked as persisted' do
      product = Chargify::Product.find_by_handle('green-money')
      product.persisted?.should == true
    end
  end

end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
chargify_api_ares-1.4.15 spec/resources/product_spec.rb
chargify_api_ares-1.4.14 spec/resources/product_spec.rb
chargify_api_ares-1.4.13 spec/resources/product_spec.rb
chargify_api_ares-1.4.11 spec/resources/product_spec.rb
chargify_api_ares-1.4.10 spec/resources/product_spec.rb
chargify_api_ares-1.4.7 spec/resources/product_spec.rb
chargify_api_ares-1.4.6 spec/resources/product_spec.rb
chargify_api_ares-1.4.5 spec/resources/product_spec.rb
chargify_api_ares-1.4.4 spec/resources/product_spec.rb
chargify_api_ares-1.4.3 spec/resources/product_spec.rb
chargify_api_ares-1.4.2 spec/resources/product_spec.rb
chargify_api_ares-1.4.1 spec/resources/product_spec.rb
chargify_api_ares-1.4.0 spec/resources/product_spec.rb
chargify_api_ares-1.3.5 spec/resources/product_spec.rb
chargify_api_ares-1.3.4 spec/resources/product_spec.rb
chargify_api_ares-1.3.3 spec/resources/product_spec.rb
chargify_api_ares-1.3.2 spec/resources/product_spec.rb
chargify_api_ares-1.3.1 spec/resources/product_spec.rb
chargify_api_ares-1.3.0 spec/resources/product_spec.rb
chargify_api_ares-1.2.1 spec/resources/product_spec.rb