Sha256: d5e002271248ae3bf4c4908776ca56d6472a6ecb4d5d01c8c5ee80af3776de43

Contents?: true

Size: 1.09 KB

Versions: 12

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

describe Chargify::Product do

  describe '.all' do

    it "should return a list of products" do
      stub_get "https://OU812:x@pengwynn.chargify.com/products.json", "products.json"
      products = Chargify::Product.all
      products.first.accounting_code.should == 'TSMO'
    end

  end

  describe '.find' do

    it "should return info for a product" do
      stub_get "https://OU812:x@pengwynn.chargify.com/products/8.json", "product.json"
      product = Chargify::Product.find(8)
      product.accounting_code.should == 'TSMO'
    end
    
    it "should return nil if the product does not exist for a product" do
      stub_get "https://OU812:x@pengwynn.chargify.com/products/99.json", "", 404
      Chargify::Product.find(99).should == nil
    end

  end

  describe '.find_by_handle' do

    it "should return info for a product by its handle" do
      stub_get "https://OU812:x@pengwynn.chargify.com/products/handle/tweetsaver.json", "product.json"
      product = Chargify::Product.find_by_handle('tweetsaver')
      product.accounting_code.should == 'TSMO'
    end

  end

end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
stefl-chargify-0.3.10 spec/unit/chargify/product_spec.rb
stefl-chargify-0.3.6 spec/unit/chargify/product_spec.rb
stefl-chargify-0.3.5 spec/unit/chargify/product_spec.rb
stefl-chargify-0.3.4 spec/unit/chargify/product_spec.rb
stefl-chargify-0.3.3 spec/unit/chargify/product_spec.rb
jsmestad-chargify-0.3.3 spec/unit/chargify/product_spec.rb
jsmestad-chargify-0.3.2.2 spec/unit/chargify/product_spec.rb
jsmestad-chargify-0.3.2.1 spec/unit/chargify/product_spec.rb
jsmestad-chargify-0.3.2 spec/unit/chargify/product_spec.rb
jsmestad-chargify-0.3.1 spec/unit/chargify/product_spec.rb
jsmestad-chargify-0.3.0 spec/unit/chargify/product_spec.rb
jsmestad-chargify-0.3.0.pre6 spec/unit/chargify/product_spec.rb