Skip to content

Commit 908d53b

Browse files
committed
Only load AWS test credentials once
Whenever the tests run, the following error appeared: warning: already initialized constant AWSTestCredentials This moves the AWSTestCredentials init from the individual specs to a spec helper class: `spec/support/helpers/amazon_helpers.rb`.
1 parent 049290d commit 908d53b

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

spec/lib/amazon_product_api/item_lookup_endpoint_spec.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# frozen_string_literal: true
22

33
require 'amazon_product_api/item_lookup_endpoint'
4+
require 'support/helpers/amazon_helpers'
45

56
describe AmazonProductAPI::ItemLookupEndpoint do
6-
AWSTestCredentials = Struct.new(:access_key, :secret_key, :associate_tag)
7-
87
let(:aws_credentials) {
98
AWSTestCredentials.new('aws_access_key',
109
'aws_secret_key',

spec/lib/amazon_product_api/item_search_endpoint_spec.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# frozen_string_literal: true
22

33
require 'amazon_product_api/item_search_endpoint'
4+
require 'support/helpers/amazon_helpers'
45

56
describe AmazonProductAPI::ItemSearchEndpoint do
6-
AWSTestCredentials = Struct.new(:access_key, :secret_key, :associate_tag)
7-
87
let(:aws_credentials) {
98
AWSTestCredentials.new('aws_access_key',
109
'aws_secret_key',
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# frozen_string_literal: true
2+
3+
# Mocks an AWS Credentials object
4+
AWSTestCredentials = Struct.new(:access_key,
5+
:secret_key,
6+
:associate_tag)

0 commit comments

Comments
 (0)