Sha256: 63f025078c3ef5e49f08b214bda88b7f2d6251b8391399def8b61d7929b9f3f0

Contents?: true

Size: 1.08 KB

Versions: 11

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe StripeLocal::Plan do
  let(:response) { File.read("./spec/webhook_fixtures/plan.created.json") }
  let(:stripe_plan) { Stripe::Invoice.construct_from(MultiJson.load(response)) }

  # it "normalizes a plan created in the stripe dashboard and saves it locally" do
  #   Stripe::Plan.should_not_receive :create
  #
  #   plan = StripeLocal::Plan.create( stripe_plan )
  #   plan.id.should eq "HR99"
  #   plan.amount.should eq 9900
  #   plan.synced?.should be_true
  # end

  it "will remotely sync creation of a new plan" do
    Stripe::Plan.should_receive :create

    plan = StripeLocal::Plan.create( id: "New_Plan", amount: 2999, interval: "month", name: "New Plan" )
    plan.id.should eq "New_Plan"
    plan.amount.should eq 2999
  end

  # context "existing plan" do
  #   before { Plan.create id: 'HR99', amount: 9900, synced: false }
  #   it "will mark an existing plan as 'synced' upon an incoming 'plan.created' hook" do
  #     Plan.should_not_receive :sync_create
  #
  #     plan = Plan.create( stripe_plan )
  #     plan.synced.should be_true
  #   end
  # end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
stripe_local-0.2.5 spec/models/stripe_local/plan_spec.rb
stripe_local-0.2.4 spec/models/stripe_local/plan_spec.rb
stripe_local-0.2.3 spec/models/stripe_local/plan_spec.rb
stripe_local-0.2.2 spec/models/stripe_local/plan_spec.rb
stripe_local-0.2.1 spec/models/stripe_local/plan_spec.rb
stripe_local-0.2.0 spec/models/stripe_local/plan_spec.rb
stripe_local-0.1.3 spec/models/stripe_local/plan_spec.rb
stripe_local-0.1.2 spec/models/stripe_local/plan_spec.rb
stripe_local-0.1.1 spec/models/stripe_local/plan_spec.rb
stripe_local-0.1.0 spec/models/stripe_local/plan_spec.rb
stripe_local-0.0.2 spec/models/stripe_local/plan_spec.rb