27 lines
611 B
Ruby
27 lines
611 B
Ruby
# frozen_string_literal: true
|
|||
|
|
|
||
|
|
require 'rails_helper'
|
||
|
|
|
||
module DiscourseSubscriptions
|
|||
RSpec.describe CustomersController do
|
|||
|
|
describe "create" do
|
||
describe "authenticated" do
|
|||
|
|
let(:user) { Fabricate(:user, email: '[email protected]') }
|
||
|
|||
before do
|
|||
|
|
sign_in(user)
|
||
|
|
end
|
||
|
|||
it "creates a stripe customer" do
|
|||
|
|
::Stripe::Customer.expects(:create).with(
|
||
|
|
email: '[email protected]',
|
||
|
|
source: 'tok_interesting'
|
||
|
|
)
|
||
|
|||
post "/s/customers.json", params: { source: 'tok_interesting' }
|
|||
end
|
|||
end
|
|||
|
|
end
|
||
|
|
end
|
||
|
|
end
|