Improve StripeAccountsController#connect spec

We are manually testing this while this is already covering the
connection of a Stripe account to an OFN instance. This makes it a bit
more comprehensive.
This commit is contained in:
Pau Perez
2020-08-27 13:43:54 +02:00
parent 300e12371a
commit 6e3cfe9c54

View File

@@ -13,11 +13,9 @@ describe Admin::StripeAccountsController, type: :controller do
end
it "redirects to Stripe Authorization url constructed OAuth" do
spree_get :connect
expect(response.location).to match %r(\Ahttps://connect.stripe.com)
uri = URI.parse(response.location)
params = CGI.parse(uri.query)
expect(params.keys).to include 'client_id', 'response_type', 'state', 'scope'
spree_get :connect, enterprise_id: 1 # A deterministic id results in a deterministic state JWT token
expect(response).to redirect_to("https://connect.stripe.com/oauth/authorize?state=eyJhbGciOiJIUzI1NiJ9.eyJlbnRlcnByaXNlX2lkIjoiMSJ9.jSSFGn0bLhwuiQYK5ORmHWW7aay1l030bcfGwn1JbFg&scope=read_write&client_id=some_id&response_type=code")
end
end