Skip to content

Commit 5d54968

Browse files
committed
Add default value to Context::scope parameter to make it optional
1 parent dbf36b7 commit 5d54968

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

lib/shopify_api/context.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class << self
3333
api_key: String,
3434
api_secret_key: String,
3535
api_version: String,
36-
scope: T.any(T::Array[String], String),
3736
is_private: T::Boolean,
3837
is_embedded: T::Boolean,
38+
scope: T.any(T::Array[String], String),
3939
log_level: T.any(String, Symbol),
4040
logger: T.untyped,
4141
host_name: T.nilable(String),
@@ -51,9 +51,9 @@ def setup(
5151
api_key:,
5252
api_secret_key:,
5353
api_version:,
54-
scope:,
5554
is_private:,
5655
is_embedded:,
56+
scope: [],
5757
log_level: :info,
5858
logger: ::Logger.new($stdout),
5959
host_name: nil,

test/context_test.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,19 @@ def test_send_a_warning_if_log_level_is_invalid
165165
)
166166
end
167167

168+
def test_scope_config_can_be_optional_and_defaults_to_empty
169+
ShopifyAPI::Context.setup(
170+
api_key: "",
171+
api_secret_key: "",
172+
api_version: "2023-10",
173+
host_name: "",
174+
is_private: false,
175+
is_embedded: true,
176+
)
177+
178+
assert_equal(ShopifyAPI::Auth::AuthScopes.new, ShopifyAPI::Context.scope)
179+
end
180+
168181
def teardown
169182
ShopifyAPI::Context.deactivate_session
170183
end

0 commit comments

Comments
 (0)