Skip to content

Commit

Permalink
Add Subscription configuration values
Browse files Browse the repository at this point in the history
:end_date, :interval_length and :interval_units are stored on the
subscription line items before the order is completed.

Once the order is completed we want a canonical source for these values.
These values will now be stored on the subscription itself, once it is
created
  • Loading branch information
Brendan Deere committed Feb 3, 2017
1 parent 9f3a33f commit b01c9d0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class AddConfigOptionsToSubscriptions < ActiveRecord::Migration
def change
add_column :solidus_subscriptions_subscriptions, :interval_length, :integer
add_column :solidus_subscriptions_subscriptions, :interval_units, :integer
add_column :solidus_subscriptions_subscriptions, :end_date, :datetime
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FactoryGirl.define do
factory :subscription, class: 'SolidusSubscriptions::Subscription' do
store
interval_length 1
interval_units :month

user do
ccs = build_list(:credit_card, 1, gateway_customer_profile_id: 'BGS-123', default: true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

describe "#cancel" do
let(:subscription) do
create :subscription, actionable_date: (Date.current + 1.month), user: user
create :subscription, :with_line_item, actionable_date: (Date.current + 1.month), user: user
end

it "returns the canceled record", :aggregate_failures do
Expand All @@ -18,7 +18,7 @@

context 'when the miniumum notice has been past' do
let(:subscription) do
create :subscription, actionable_date: Date.current, user: user
create :subscription, :with_line_item, actionable_date: Date.current, user: user
end

it "returns the record pending cancellation", :aggregate_failures do
Expand Down

0 comments on commit b01c9d0

Please sign in to comment.