namespace subscriptions controller
This commit is contained in:
parent
321f6b8a71
commit
91045583ad
|
@ -1,14 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiscoursePatrons
|
||||
class SubscriptionsController < ::Admin::AdminController
|
||||
include DiscoursePatrons::Stripe
|
||||
module Admin
|
||||
class SubscriptionsController < ::Admin::AdminController
|
||||
include DiscoursePatrons::Stripe
|
||||
|
||||
before_action :set_api_key
|
||||
before_action :set_api_key
|
||||
|
||||
def index
|
||||
subscriptions = ::Stripe::Subscription.list
|
||||
subscriptions.to_json
|
||||
def index
|
||||
subscriptions = ::Stripe::Subscription.list
|
||||
subscriptions.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
DiscoursePatrons::Engine.routes.draw do
|
||||
# TODO: namespace this
|
||||
scope 'admin' do
|
||||
get '/' => 'admin#index'
|
||||
|
||||
resources :subscriptions, only: [:index]
|
||||
end
|
||||
|
||||
namespace :admin do
|
||||
resources :plans
|
||||
resources :subscriptions, only: [:index]
|
||||
end
|
||||
|
||||
get '/' => 'patrons#index'
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
module DiscoursePatrons
|
||||
module Admin
|
||||
RSpec.describe SubscriptionsController do
|
||||
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
|
||||
before { sign_in(admin) }
|
||||
|
||||
it 'is a subclass of AdminController' do
|
||||
expect(DiscoursePatrons::Admin::SubscriptionsController < ::Admin::AdminController).to eq(true)
|
||||
end
|
||||
|
||||
it "gets the empty subscriptions" do
|
||||
::Stripe::Subscription.expects(:list)
|
||||
get "/patrons/admin/subscriptions.json"
|
||||
expect(response.status).to eq(204)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,22 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
module DiscoursePatrons
|
||||
RSpec.describe SubscriptionsController do
|
||||
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
|
||||
before { sign_in(admin) }
|
||||
|
||||
it 'is a subclass of AdminController' do
|
||||
expect(DiscoursePatrons::SubscriptionsController < ::Admin::AdminController).to eq(true)
|
||||
end
|
||||
|
||||
it "gets the empty subscriptions" do
|
||||
::Stripe::Subscription.expects(:list)
|
||||
get "/patrons/admin/subscriptions.json"
|
||||
expect(response.status).to eq(204)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
export default function(helpers) {
|
||||
const { response } = helpers;
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
export function stubStripe() {
|
||||
window.Stripe = () => {
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue