discourse-subscriptions/spec/requests/admin/subscriptions_controller_sp...

32 lines
821 B
Ruby
Raw Normal View History

2019-10-09 22:09:24 -04:00
# frozen_string_literal: true
require 'rails_helper'
module DiscoursePatrons
2019-10-09 22:52:55 -04:00
RSpec.describe Admin::SubscriptionsController do
it 'is a subclass of AdminController' do
expect(DiscoursePatrons::Admin::SubscriptionsController < ::Admin::AdminController).to eq(true)
end
2019-10-09 22:09:24 -04:00
2019-10-14 22:18:25 -04:00
context 'unauthenticated' do
it "does nothing" do
::Stripe::Subscription.expects(:list).never
get "/patrons/admin/subscriptions.json"
expect(response.status).to eq(403)
end
end
context 'authenticated' do
let(:admin) { Fabricate(:admin) }
before { sign_in(admin) }
it "gets the empty subscriptions" do
::Stripe::Subscription.expects(:list)
get "/patrons/admin/subscriptions.json"
expect(response.status).to eq(200)
end
2019-10-09 22:09:24 -04:00
end
end
end