Skip to content

Commit 7ef47f6

Browse files
committed
rubo cop
1 parent 114a2ac commit 7ef47f6

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

lib/shopify_app/managers/script_tags_manager.rb

+7-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ def create_script_tags(session:)
5656
if template_types_to_check.all? do |template_type|
5757
template_supports_app_blocks?(active_theme["id"], template_type)
5858
end
59-
ShopifyApp::Logger.info("Theme supports app blocks for templates: #{template_types_to_check.join(", ")}. Skipping script tag creation.")
59+
ShopifyApp::Logger.info(
60+
"Theme supports app blocks for templates: #{template_types_to_check.join(", ")}. " \
61+
"Skipping script tag creation.",
62+
)
6063
return
6164
end
6265
end
@@ -349,7 +352,9 @@ def fetch_all_script_tags
349352
end
350353

351354
# Handle nil data or missing structure
352-
return [] unless response.body["data"] && response.body["data"]["scriptTags"] && response.body["data"]["scriptTags"]["edges"]
355+
return [] unless response.body["data"] &&
356+
response.body["data"]["scriptTags"] &&
357+
response.body["data"]["scriptTags"]["edges"]
353358

354359
response.body["data"]["scriptTags"]["edges"].map { |edge| edge["node"] }
355360
rescue => e

test/shopify_app/managers/script_tags_manager_test.rb

+12-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ class ShopifyApp::ScriptTagsManagerTest < ActiveSupport::TestCase
6666
})
6767

6868
# Set up the sequence of responses
69-
@mock_client.stubs(:query).returns(empty_response).then.returns(success_response).then.returns(success_response).then.returns(success_response)
69+
@mock_client.stubs(:query)
70+
.returns(empty_response)
71+
.then.returns(success_response)
72+
.then.returns(success_response)
73+
.then.returns(success_response)
7074

7175
@manager.create_script_tags(session: @session)
7276

@@ -453,7 +457,13 @@ class ShopifyApp::ScriptTagsManagerTest < ActiveSupport::TestCase
453457
# Set up the sequence of responses for the GraphQL client
454458
# The code will stop checking templates once it finds one that doesn't support app blocks
455459
# So we only need to set up expectations for the queries that will actually be made
456-
@mock_client.stubs(:query).returns(theme_response).then.returns(product_template_response).then.returns(product_section_response).then.returns(collection_template_response).then.returns(collection_section_response).then.returns(empty_script_tags_response)
460+
@mock_client.stubs(:query)
461+
.returns(theme_response)
462+
.then.returns(product_template_response)
463+
.then.returns(product_section_response)
464+
.then.returns(collection_template_response)
465+
.then.returns(collection_section_response)
466+
.then.returns(empty_script_tags_response)
457467

458468
# Expect script tag creation calls
459469
expect_script_tag_creation("https://example-app.com/fancy.js")

0 commit comments

Comments
 (0)