2019-09-11 03:57:29 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
module DiscoursePatrons
|
|
|
|
RSpec.describe PatronsController, type: :controller do
|
|
|
|
routes { DiscoursePatrons::Engine.routes }
|
2019-09-11 04:32:09 -04:00
|
|
|
|
2019-09-11 05:11:02 -04:00
|
|
|
describe 'index' do
|
|
|
|
it 'responds ok' do
|
|
|
|
get :index, format: :json
|
|
|
|
expect(response).to have_http_status(200)
|
|
|
|
end
|
|
|
|
end
|
2019-09-11 04:32:09 -04:00
|
|
|
|
2019-09-11 05:11:02 -04:00
|
|
|
describe 'create' do
|
2019-09-11 05:55:35 -04:00
|
|
|
before do
|
|
|
|
SiteSetting.stubs(:discourse_patrons_currency).returns('AUD')
|
|
|
|
SiteSetting.stubs(:discourse_patrons_secret_key).returns('xyz-678')
|
|
|
|
end
|
|
|
|
|
2019-09-11 05:11:02 -04:00
|
|
|
it 'responds ok' do
|
2019-09-11 05:55:35 -04:00
|
|
|
::Stripe::PaymentIntent.expects(:create)
|
2019-09-11 05:27:24 -04:00
|
|
|
post :create, params: {}, format: :json
|
2019-09-11 04:32:09 -04:00
|
|
|
expect(response).to have_http_status(200)
|
|
|
|
end
|
|
|
|
end
|
2019-09-11 03:57:29 -04:00
|
|
|
end
|
|
|
|
end
|