Skip to content

Commit

Permalink
Fix: inform_admin! not everyone.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Nov 15, 2023
1 parent a037bd3 commit c837a05
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion slack-gamebot/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def check_subscribed_teams!
Team.where(subscribed: true, :stripe_customer_id.ne => nil).each do |team|
if team.stripe_customer.subscriptions.none?
logger.info "No active subscriptions for #{team} (#{team.stripe_customer_id}), downgrading."
team.inform! 'Your subscription was canceled and your team has been downgraded. Thank you for being a customer!'
team.inform_admin! 'Your subscription was canceled and your team has been downgraded. Thank you for being a customer!'
team.update_attributes!(subscribed: false)
else
team.stripe_customer.subscriptions.each do |subscription|
Expand Down
4 changes: 2 additions & 2 deletions spec/slack-gamebot/app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
expect_any_instance_of(Team).to receive(:inform_admin!).with("Your subscription to Plan ($29.99) is past due. #{team.update_cc_text}")
subject.send(:check_subscribed_teams!)
end
it 'notifies past due subscription' do
it 'notifies canceled subscription' do
customer.subscriptions.data.first['status'] = 'canceled'
expect(Stripe::Customer).to receive(:retrieve).and_return(customer)
expect_any_instance_of(Team).to receive(:inform_admin!).with('Your subscription to Plan ($29.99) was canceled and your team has been downgraded. Thank you for being a customer!')
Expand All @@ -66,7 +66,7 @@
it 'notifies no active subscriptions' do
customer.subscriptions.data = []
expect(Stripe::Customer).to receive(:retrieve).and_return(customer)
expect_any_instance_of(Team).to receive(:inform!).with('Your subscription was canceled and your team has been downgraded. Thank you for being a customer!')
expect_any_instance_of(Team).to receive(:inform_admin!).with('Your subscription was canceled and your team has been downgraded. Thank you for being a customer!')
subject.send(:check_subscribed_teams!)
expect(team.reload.subscribed?).to be false
end
Expand Down

0 comments on commit c837a05

Please sign in to comment.