Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #323 from solidusio/gsmendoza/eng-384-fix-solidusp…
Browse files Browse the repository at this point in the history
…aypalbraintree-specs-are

Fix specs to stub spree_current_user
  • Loading branch information
kennyadsl authored Jul 5, 2022
2 parents 9fc19a4 + 38a5cad commit 4890572
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/models/solidus_paypal_braintree/gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class TokenGenerationDisabledError < StandardError; end
# Error message from Braintree that gets returned by a non voidable transaction
NON_VOIDABLE_STATUS_ERROR_REGEXP = /can only be voided if status is authorized/.freeze

TOKEN_GENERATION_DISABLED_MESSAGE = 'Token generation is disabled.' \
' To re-enable set the `token_generation_enabled` preference on the' \
' gateway to `true`.'
TOKEN_GENERATION_DISABLED_MESSAGE = 'Token generation is disabled. ' \
'To re-enable set the `token_generation_enabled` preference on the ' \
'gateway to `true`.'

ALLOWED_BRAINTREE_OPTIONS = [
:device_data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@

it "has a failed status" do
post_create
expect(response.status).to eq 422
expect(response).to have_http_status :unprocessable_entity
end

it "returns the errors as JSON" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
allow_any_instance_of(Spree::CheckoutController).to receive_messages(spree_current_user: user)
allow_any_instance_of(Spree::Payment).to receive(:number).and_return("123ABC")
allow_any_instance_of(SolidusPaypalBraintree::Source).to receive(:nonce).and_return("fake-valid-nonce")

Expand Down
6 changes: 5 additions & 1 deletion spec/features/frontend/venmo_checkout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ def go_to_payment_checkout_page(order_number: 'R300000001' )
order.update!(user: user, number: order_number) # constant order number for VCRs

allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: Spree::User.first)

first_user = Spree::User.first
allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: first_user)
allow_any_instance_of(Spree::CheckoutController).to receive_messages(spree_current_user: first_user)

allow_any_instance_of(Spree::Payment).to receive(:gateway_order_id).and_return(order_number)

visit spree.checkout_state_path(order.state)
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/spree/api/orders_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
it "can be rendered correctly" do
get "/api/orders/#{order.number}"

expect(response.status).to eq 200
expect(response).to have_http_status :ok
end
end
end
Expand Down

0 comments on commit 4890572

Please sign in to comment.