2019-07-30 21:29:24 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-25 16:15:39 +00:00
|
|
|
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
2018-03-25 17:30:42 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
require 'insert/insert_billing_subscriptions'
|
|
|
|
require 'query/query_billing_subscriptions'
|
|
|
|
|
2019-07-30 21:29:24 +00:00
|
|
|
describe QueryBillingSubscriptions, pending: true do
|
2018-03-25 17:30:42 +00:00
|
|
|
before(:each) do
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '.plan_tier' do
|
|
|
|
it 'gives tier 0 if status=inactive' do
|
2019-07-30 21:29:24 +00:00
|
|
|
Qx.update(:billing_subscriptions).set(status: 'inactive').where('id = $id', id: @sub['id']).execute
|
2018-03-25 17:30:42 +00:00
|
|
|
expect(QueryBillingSubscriptions.plan_tier(3624)).to eq(0)
|
2019-07-30 21:29:24 +00:00
|
|
|
raise
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
it 'gives tier 0 if no subscription' do
|
|
|
|
expect(QueryBillingSubscriptions.plan_tier(666)).to eq(0)
|
2019-07-30 21:29:24 +00:00
|
|
|
raise
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
it 'gives tier 2 if status=active' do
|
2019-07-30 21:29:24 +00:00
|
|
|
Qx.update(:billing_subscriptions).set(status: 'active').where('id = $id', id: @sub['id']).execute
|
2018-03-25 17:30:42 +00:00
|
|
|
expect(QueryBillingSubscriptions.plan_tier(3624)).to eq(2)
|
2019-07-30 21:29:24 +00:00
|
|
|
raise
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|