summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/migrate/20170112012407_add_config_options_to_subscriptions.rb7
-rw-r--r--lib/solidus_subscriptions/testing_support/factories/subscription_factory.rb2
-rw-r--r--spec/requests/solidus_subscriptions/api/v1/subscriptions_spec.rb4
3 files changed, 11 insertions, 2 deletions
diff --git a/db/migrate/20170112012407_add_config_options_to_subscriptions.rb b/db/migrate/20170112012407_add_config_options_to_subscriptions.rb
new file mode 100644
index 0000000..6020179
--- /dev/null
+++ b/db/migrate/20170112012407_add_config_options_to_subscriptions.rb
@@ -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
diff --git a/lib/solidus_subscriptions/testing_support/factories/subscription_factory.rb b/lib/solidus_subscriptions/testing_support/factories/subscription_factory.rb
index 61baa33..222f9ef 100644
--- a/lib/solidus_subscriptions/testing_support/factories/subscription_factory.rb
+++ b/lib/solidus_subscriptions/testing_support/factories/subscription_factory.rb
@@ -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)
diff --git a/spec/requests/solidus_subscriptions/api/v1/subscriptions_spec.rb b/spec/requests/solidus_subscriptions/api/v1/subscriptions_spec.rb
index 3950684..62723a8 100644
--- a/spec/requests/solidus_subscriptions/api/v1/subscriptions_spec.rb
+++ b/spec/requests/solidus_subscriptions/api/v1/subscriptions_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe "Subscription endpoints", type: :request do
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
@@ -18,7 +18,7 @@ RSpec.describe "Subscription endpoints", type: :request do
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