Sha256: e1c878fc1f65a3554a328af80707e0bdfc45e898562a4cce0487453c9f605539

Contents?: true

Size: 773 Bytes

Versions: 3

Compression:

Stored size: 773 Bytes

Contents

require 'spec_helper'

module Susply
  describe CreateSubscription do
    it "creates the subscription" do
      owner = Organization.create(name: "Iokero", subdomain: 'iokero')
      plan = create(:susply_plan, interval: 'monthly')

      subscription = Susply::CreateSubscription.call(owner, plan)

      expect(subscription.id).not_to be_nil
      expect(subscription.owner).to eq owner
      expect(subscription.plan).to eq plan
      expect(subscription.quantity).to eq 1
      expect(subscription.start).to be_within(1.second).of(Time.zone.now)
      expect(subscription.current_period_start).
        to be_within(2.second).of(Time.zone.now)
      expect(subscription.current_period_end).
        to be_within(2.second).of(Time.zone.now + 1.month)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
susply-1.0.0 spec/services/susply/create_subscription_spec.rb
susply-0.0.2 spec/services/susply/create_subscription_spec.rb
susply-0.0.1 spec/services/susply/create_subscription_spec.rb