From 9e0466cb833152407bb712b739aa9ef531b9a0e5 Mon Sep 17 00:00:00 2001 From: Javier Julio Date: Mon, 1 Aug 2016 13:04:46 -0400 Subject: [PATCH 1/2] Fix Travis failure on nil ENV['BITPAYPEM'] The commit 671fe5657b3558c242fa2367e979c3d9ca571b2b introduced (a new ENV['BITPAYPEM'])[https://github.com/bitpay/ruby-client/commit/671fe5657b3558c242fa2367e979c3d9ca571b2b#diff-2fbdf6e6f53a9bb9a2c06059507373a8R18] but it wasn't defined anywhere. There is already (a constant called `PEM` in the `spec_helper.rb` file)[https://github.com/bitpay/ruby-client/blob/master/spec/spec_helper.rb#L12] so figured it should just use that. This could be moved to the constants config file instead if preferred and use the ENV variable and default to a value if ENV variable is nil. --- features/step_definitions/step_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/step_definitions/step_helpers.rb b/features/step_definitions/step_helpers.rb index 8aa88c3..999801f 100644 --- a/features/step_definitions/step_helpers.rb +++ b/features/step_definitions/step_helpers.rb @@ -15,7 +15,7 @@ module BitPay end def new_client_from_stored_values - pem = ENV['BITPAYPEM'].gsub("\\n", "\n") + pem = PEM.gsub("\\n", "\n") BitPay::SDK::Client.new(api_uri: APIURI, pem: pem, insecure: true) end From 95d859b7efd51a9c1309f223e7ea65bcbca2e39a Mon Sep 17 00:00:00 2001 From: Javier Julio Date: Mon, 1 Aug 2016 13:11:55 -0400 Subject: [PATCH 2/2] Add PEM constant for cucumber tests The tests failing are for cucumber so using the constant in step_helpers.rb didn't fix anything since we need it defined here. I saw it defined in spec_helper.rb but that's only for rspec tests. --- config/constants.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/constants.rb b/config/constants.rb index 0b81a6a..5a05f9f 100644 --- a/config/constants.rb +++ b/config/constants.rb @@ -6,6 +6,7 @@ # APIURI = ENV['BITPAYAPI'] +PEM = ENV['BITPAYPEM'] || "-----BEGIN EC PRIVATE KEY-----\nMHQCAQEEICg7E4NN53YkaWuAwpoqjfAofjzKI7Jq1f532dX+0O6QoAcGBSuBBAAK\noUQDQgAEjZcNa6Kdz6GQwXcUD9iJ+t1tJZCx7hpqBuJV2/IrQBfue8jh8H7Q/4vX\nfAArmNMaGotTpjdnymWlMfszzXJhlw==\n-----END EC PRIVATE KEY-----\n" # Specify a bitpay txid which has 6+ confirmations. Default belongs to 'bitpayrubyclient@gmail.com' test account REFUND_TRANSACTION = ENV['REFUND_TRANSACTION']