diff --git a/CHANGELOG.md b/CHANGELOG.md index 6704ef50..997951f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/34 +* Show better explanation what to do when there is missing test suite token environment variable. + + https://github.com/KnapsackPro/knapsack_pro-ruby/pull/35 + https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.36.0...v0.37.0 ### 0.36.0 diff --git a/lib/knapsack_pro/config/env.rb b/lib/knapsack_pro/config/env.rb index fb175ca2..34dc22d9 100644 --- a/lib/knapsack_pro/config/env.rb +++ b/lib/knapsack_pro/config/env.rb @@ -120,7 +120,8 @@ def fixed_queue_split end def test_suite_token - required_env('KNAPSACK_PRO_TEST_SUITE_TOKEN') + env_name = 'KNAPSACK_PRO_TEST_SUITE_TOKEN' + ENV[env_name] || raise("Missing environment variable #{env_name}. You should set environment variable like #{env_name}_RSPEC (note there is suffix _RSPEC at the end). knapsack_pro gem will set #{env_name} based on #{env_name}_RSPEC value. If you use other test runner than RSpec then use proper suffix.") end def test_suite_token_rspec diff --git a/spec/knapsack_pro/config/env_spec.rb b/spec/knapsack_pro/config/env_spec.rb index 2ddc1ca2..e37ec8d9 100644 --- a/spec/knapsack_pro/config/env_spec.rb +++ b/spec/knapsack_pro/config/env_spec.rb @@ -466,7 +466,7 @@ context "when ENV doesn't exist" do it do - expect { subject }.to raise_error('Missing environment variable KNAPSACK_PRO_TEST_SUITE_TOKEN') + expect { subject }.to raise_error('Missing environment variable KNAPSACK_PRO_TEST_SUITE_TOKEN. You should set environment variable like KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC (note there is suffix _RSPEC at the end). knapsack_pro gem will set KNAPSACK_PRO_TEST_SUITE_TOKEN based on KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC value. If you use other test runner than RSpec then use proper suffix.') end end end