Skip to content

Commit

Permalink
Fix a few new rubocop "offenses"
Browse files Browse the repository at this point in the history
  • Loading branch information
elia committed Oct 5, 2020
1 parent 8aaef9d commit 73e5f6b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ def paypal_address_params
],
recipient: [
:email_address,
name: [
:given_name,
:surname,
]
{
name: [
:given_name,
:surname,
]
}
]
)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/solidus_paypal_commerce_platform/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Client

attr_reader :environment

def initialize(test_mode: nil, client_id:, client_secret: "")
def initialize(client_id:, client_secret: "", test_mode: nil)
test_mode = SolidusPaypalCommercePlatform.config.env.sandbox? if test_mode.nil?
env_class = test_mode ? PayPal::SandboxEnvironment : PayPal::LiveEnvironment

Expand Down
6 changes: 3 additions & 3 deletions spec/features/frontend/product_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ def paypal_script_options
end

it "generates a js file with the correct credentials and intent attached" do
visit '/products/' + product.slug
visit "/products/#{product.slug}"
expect(paypal_script_options).to include("client-id=#{paypal_payment_method.preferences[:client_id]}")
end

context "when auto-capture is set to true" do
it "generates a js file with intent capture" do
paypal_payment_method.update(auto_capture: true)
visit '/products/' + product.slug
visit "/products/#{product.slug}"
expect(paypal_script_options).to include("client-id=#{paypal_payment_method.preferences[:client_id]}")
expect(paypal_script_options).to include("intent=capture")
end
Expand All @@ -34,7 +34,7 @@ def paypal_script_options
describe "order creation" do
before do
allow_any_instance_of(Spree::Core::ControllerHelpers::Store).to receive(:current_store) { store }
visit '/products/' + product.slug
visit "/products/#{product.slug}"

# Stubbing out paypal methods since their JS doesn't load in correctly on tests
page.execute_script("paypal = {}")
Expand Down

0 comments on commit 73e5f6b

Please sign in to comment.