2019-10-10 21:26:01 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
2019-12-03 19:23:45 -05:00
|
|
|
module DiscourseSubscriptions
|
2019-10-10 21:26:01 -04:00
|
|
|
RSpec.describe CustomersController do
|
|
|
|
describe "create" do
|
2019-10-25 20:31:19 -04:00
|
|
|
describe "authenticated" do
|
|
|
|
let(:user) { Fabricate(:user, email: 'hello.2@example.com') }
|
2019-10-10 21:26:01 -04:00
|
|
|
|
2019-10-25 20:31:19 -04:00
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "creates a stripe customer" do
|
|
|
|
::Stripe::Customer.expects(:create).with(
|
|
|
|
email: 'hello.2@example.com',
|
|
|
|
source: 'tok_interesting'
|
|
|
|
)
|
|
|
|
|
2019-12-02 19:48:12 -05:00
|
|
|
post "/s/customers.json", params: { source: 'tok_interesting' }
|
2019-10-25 20:31:19 -04:00
|
|
|
end
|
2019-10-10 21:26:01 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|