Sha256: 921f462f70c22e8e64c9c4ebfaaf0497f95b6eb0d6bd06382a137fa8027fb569

Contents?: true

Size: 862 Bytes

Versions: 3

Compression:

Stored size: 862 Bytes

Contents

require 'spec_helper'

describe Chargify::Product 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

3 entries across 3 versions & 1 rubygems

Version Path
chargify_api_ares-0.5.4 spec/resources/product_spec.rb
chargify_api_ares-0.5.2 spec/resources/product_spec.rb
chargify_api_ares-0.5.1 spec/resources/product_spec.rb