Sha256: 77ae4964f06f24d82b9ef7a0ccc64b4df0fe2a4c2f7432410378096a220bfc1d

Contents?: true

Size: 789 Bytes

Versions: 21

Compression:

Stored size: 789 Bytes

Contents

require 'test_helper'

class DiscoApp::SubscriptionServiceTest < ActiveSupport::TestCase

  def setup
    @shop = disco_app_shops(:widget_store)
    @current_subscription = @shop.current_subscription
  end

  def teardown
    @shop = nil
  end

  test 'subscribing to a new plan deactivates current subscription and swaps to new plan' do
    DiscoApp::SubscriptionService.subscribe(@shop, disco_app_plans(:premium))
    @current_subscription.reload
    assert @current_subscription.replaced?
    assert_equal disco_app_plans(:premium), @shop.current_subscription.plan
  end

  test 'cancelling a plan works' do
    DiscoApp::SubscriptionService.cancel(@shop)
    @current_subscription.reload
    assert @current_subscription.cancelled?
    assert_not @shop.current_subscription
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
disco_app-0.6.0 test/services/disco_app/subscription_service_test.rb
disco_app-0.6.1 test/services/disco_app/subscription_service_test.rb
disco_app-0.6.2 test/services/disco_app/subscription_service_test.rb
disco_app-0.6.3 test/services/disco_app/subscription_service_test.rb
disco_app-0.6.4 test/services/disco_app/subscription_service_test.rb
disco_app-0.6.5 test/services/disco_app/subscription_service_test.rb
disco_app-0.6.6 test/services/disco_app/subscription_service_test.rb
disco_app-0.6.7 test/services/disco_app/subscription_service_test.rb
disco_app-0.6.8 test/services/disco_app/subscription_service_test.rb
disco_app-0.6.9 test/services/disco_app/subscription_service_test.rb
disco_app-0.7.0 test/services/disco_app/subscription_service_test.rb
disco_app-0.7.1 test/services/disco_app/subscription_service_test.rb
disco_app-0.7.2 test/services/disco_app/subscription_service_test.rb
disco_app-0.8.0 test/services/disco_app/subscription_service_test.rb
disco_app-0.8.1 test/services/disco_app/subscription_service_test.rb
disco_app-0.8.2 test/services/disco_app/subscription_service_test.rb
disco_app-0.8.3 test/services/disco_app/subscription_service_test.rb
disco_app-0.8.4 test/services/disco_app/subscription_service_test.rb
disco_app-0.8.5 test/services/disco_app/subscription_service_test.rb
disco_app-0.8.6 test/services/disco_app/subscription_service_test.rb