mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Fix specs for travis
This commit is contained in:
@@ -131,7 +131,7 @@ module Admin
|
||||
response_params = get_stripe_token(params["code"]).params
|
||||
|
||||
# In case of a problem, need to also issue a request to disconnect the account from Stripe
|
||||
if !(spree_current_user.owned_enterprises.include? @enterprise) && !(spree_current_user.admin?)
|
||||
if !(spree_current_user.enterprises.include? @enterprise) && !(spree_current_user.admin?)
|
||||
deauthorize_request_for_stripe_id(response_params["stripe_user_id"])
|
||||
redirect_to '/unauthorized' and return
|
||||
end
|
||||
|
||||
@@ -147,11 +147,12 @@ module Admin
|
||||
describe "stripe connect" do
|
||||
it "redirects to Stripe" do
|
||||
controller.stub spree_current_user: distributor_manager
|
||||
Admin::StripeHelper.client.stub id: "abc"
|
||||
spree_get :stripe_connect
|
||||
['https://connect.stripe.com/oauth/authorize',
|
||||
'response_type=code',
|
||||
'state=',
|
||||
'client_id='].each{|element| response.location.should match element}
|
||||
'client_id=abc'].each{|element| response.location.should match element}
|
||||
end
|
||||
|
||||
it "returns 500 on callback if the response code is not provided" do
|
||||
@@ -200,7 +201,6 @@ module Admin
|
||||
payload = {enterprise_id: distributor.permalink}
|
||||
params = {state: JWT.encode(payload, Openfoodnetwork::Application.config.secret_token),
|
||||
code: "code"}
|
||||
|
||||
expect{spree_get :stripe_connect_callback, params}.to change{StripeAccount.all.length}.by 1
|
||||
StripeAccount.last.enterprise_id.should eq distributor.id
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user