spec the plans

This commit is contained in:
Rimian Perkins 2019-09-24 20:57:42 +10:00
parent a2d120c8b5
commit bfdc8a5691
2 changed files with 14 additions and 3 deletions

View File

@ -13,7 +13,7 @@ module DiscoursePatrons
product: {
name: 'Gold special',
},
currency: 'usd',
currency: SiteSetting.discourse_patrons_currency,
id: 'gold-special',
)

View File

@ -12,9 +12,20 @@ module DiscoursePatrons
expect(DiscoursePatrons::PlansController < Admin::AdminController).to eq(true)
end
it "creates a plan" do
::Stripe::Plan.expects(:create)
it "creates a plan with a currency" do
SiteSetting.stubs(:discourse_patrons_currency).returns('aud')
::Stripe::Plan.expects(:create).with(has_entry(:currency, 'aud'))
post "/patrons/admin/plans.json", params: {}
end
it "creates a plan with an interval" do
::Stripe::Plan.expects(:create).with(has_entry(:interval, 'week'))
post "/patrons/admin/plans.json", params: { interval: 'week' }
end
it "creates a plan with an amount" do
::Stripe::Plan.expects(:create).with(has_entry(:amount, '102'))
post "/patrons/admin/plans.json", params: { amount: '102' }
end
end
end