Sha256: 2088879da8a40076632843631f24b35f5e0bbfc77eb9380929061a8328d45c86

Contents?: true

Size: 815 Bytes

Versions: 26

Compression:

Stored size: 815 Bytes

Contents

require 'spec_helper'

describe Chargify::Migration, :fake_resource do
  context "#create" do
    it 'migrates the subscription' do
      id = generate(:subscription_id)
      subscription = build(:subscription, :id => id)
      subscription.stub!(:persisted?).and_return(true)
      expected_response = [subscription.attributes].to_xml(:root => 'subscription')

      FakeWeb.register_uri(:post, "#{test_domain}/subscriptions/#{id}/migrations.xml?migration%5Bproduct_handle%5D=upgraded-plan", :status => 201, :body => expected_response)

      response = Chargify::Migration.create(:subscription_id => subscription.id, :product_handle => 'upgraded-plan')

      expect(response.valid?).to be_true
      expect(response.errors.any?).to be_false
      expect(response).to be_a(Chargify::Migration)
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
chargify_api_ares-1.1.0 spec/resources/migration_spec.rb
chargify_api_ares-1.1.0.pre spec/resources/migration_spec.rb
chargify_api_ares-1.0.5 spec/resources/migration_spec.rb
chargify_api_ares-1.0.4 spec/resources/migration_spec.rb
chargify_api_ares-1.0.3 spec/resources/migration_spec.rb
chargify_api_ares-1.0.2 spec/resources/migration_spec.rb