-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rspec): add bin script to test RSpec --options flag with custom …
…options file Related: KnapsackPro/knapsack_pro-ruby#234
- Loading branch information
Showing
4 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--no-color | ||
--require rails_helper | ||
--format documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
bin/knapsack_pro_queue_rspec_junit_with_rspec_custom_options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
mkdir -p tmp/test-reports/rspec/queue_mode/ | ||
|
||
# must be exported to read value in below knapsack_pro command | ||
export KNAPSACK_PRO_CI_NODE_INDEX=${1:-0} | ||
|
||
CI_BUILD_ID=$(openssl rand -base64 32) | ||
|
||
export RSPEC_CUSTOM_OPTIONS_ENABLED=true | ||
|
||
KNAPSACK_PRO_ENDPOINT=http://api.knapsackpro.test:3000 \ | ||
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=a28ce51204d7c7dbd25c3352fea222cf \ | ||
KNAPSACK_PRO_REPOSITORY_ADAPTER=git \ | ||
KNAPSACK_PRO_PROJECT_DIR=. \ | ||
KNAPSACK_PRO_CI_NODE_TOTAL=${2:-2} \ | ||
KNAPSACK_PRO_CI_NODE_BUILD_ID=${3:-$CI_BUILD_ID} \ | ||
bundle exec rake "knapsack_pro:queue:rspec[--options .rspec_custom.options --format RspecJunitFormatter --out tmp/test-reports/rspec/queue_mode/rspec_$KNAPSACK_PRO_CI_NODE_INDEX.xml]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# https://rspec.info/features/3-12/rspec-core/configuration/read-options-from-file/ | ||
describe 'RSpec Options' do | ||
if ENV['RSPEC_CUSTOM_OPTIONS_ENABLED'] | ||
it { expect(RSpec.configuration.color_mode).to eq :off } | ||
else | ||
it { expect(RSpec.configuration.color_mode).to eq :automatic } | ||
end | ||
end |