Skip to content

Commit 1390eaa

Browse files
committed
remove hardcoded test variables
1 parent 976e296 commit 1390eaa

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

tools/fastlane-plugin/spec/send_build_to_bugsnag_spec.rb

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
BuildAction = Fastlane::Actions::SendBuildToBugsnagAction
88
BUGSNAG_CLI_PATH = BugsnagCli.get_bundled_path
99
GIT_REVISION = `git rev-parse HEAD`.strip
10+
BUILDER = `whoami`.strip
1011

1112

1213
describe BuildAction do
@@ -16,7 +17,7 @@ def run_with args
1617

1718
context 'building an iOS project' do
1819
it 'detects default Info.plist file excluding test dirs' do
19-
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789AAA --version-name 2.0-other --bundle-version 22 --builder-name josh.edney --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload").and_return(true)
20+
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789AAA --version-name 2.0-other --bundle-version 22 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload").and_return(true)
2021
Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
2122
run_with({})
2223
end
@@ -25,7 +26,7 @@ def run_with args
2526
it 'reads api key from legacy location' do
2627
# the API key is now in `bugsnag.apiKey`, it used to be in 'BugsnagAPIKey',
2728
# test this can be extracted correctly from the `ios_proj_legacy`
28-
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789BBB --version-name 4.0-project --bundle-version 44 --builder-name josh.edney --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload").and_return(true)
29+
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789BBB --version-name 4.0-project --bundle-version 44 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload").and_return(true)
2930
Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj_legacy')) do
3031
run_with({})
3132
end
@@ -34,7 +35,7 @@ def run_with args
3435
context 'using default config_file option' do
3536
context 'override API key from config' do
3637
it 'reads API key from the api_key option' do
37-
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789FFF --version-name 2.0-other --bundle-version 22 --builder-name josh.edney --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload").and_return(true)
38+
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789FFF --version-name 2.0-other --bundle-version 22 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload").and_return(true)
3839
Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
3940
run_with({
4041
api_key: '12345678901234567890123456789FFF'
@@ -43,7 +44,7 @@ def run_with args
4344
end
4445

4546
it 'uses input versions from options' do
46-
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789AAA --version-name 8.0.0 --bundle-version 800 --builder-name josh.edney --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload").and_return(true)
47+
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789AAA --version-name 8.0.0 --bundle-version 800 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload").and_return(true)
4748
Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
4849
run_with({
4950
app_version: '8.0.0',
@@ -56,7 +57,7 @@ def run_with args
5657

5758
context 'override config_file option' do
5859
it 'reads API key and version info from the config file' do
59-
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 3.0-project --bundle-version 33 --builder-name josh.edney --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload").and_return(true)
60+
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 3.0-project --bundle-version 33 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload").and_return(true)
6061
Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
6162
run_with({
6263
config_file: File.join('Project', 'Info.plist')
@@ -66,7 +67,7 @@ def run_with args
6667

6768
context 'override API key, and config file' do
6869
it 'uses the input api_key to override a non default config' do
69-
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789EEE --version-name 3.0-project --bundle-version 33 --builder-name josh.edney --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload").and_return(true)
70+
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789EEE --version-name 3.0-project --bundle-version 33 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload").and_return(true)
7071
Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
7172
run_with({
7273
config_file: File.join('Project', 'Info.plist'),
@@ -76,7 +77,7 @@ def run_with args
7677
end
7778

7879
it 'uses the input versions to override a non default config' do
79-
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 9.0.0 --bundle-version 900 --builder-name josh.edney --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload").and_return(true)
80+
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 9.0.0 --bundle-version 900 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload").and_return(true)
8081
Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
8182
run_with({
8283
config_file: File.join('Project', 'Info.plist'),
@@ -90,7 +91,7 @@ def run_with args
9091

9192
context 'metadata added to args' do
9293
it "single key:value pair added" do
93-
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 4.0-project --bundle-version 22 --builder-name josh.edney --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload --metadata \"test1\": \"First test\"").and_return(true)
94+
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 4.0-project --bundle-version 22 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload --metadata \"test1\": \"First test\"").and_return(true)
9495
Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
9596
run_with({
9697
app_version: '4.0-project',
@@ -101,7 +102,7 @@ def run_with args
101102
end
102103

103104
it "multiple key:value pairs added" do
104-
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 4.0-project --bundle-version 22 --builder-name josh.edney --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload --metadata \"test1\": \"First test\", \"test2\": \"Second test\", \"test3\": \"Third test\"").and_return(true)
105+
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 4.0-project --bundle-version 22 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload --metadata \"test1\": \"First test\", \"test2\": \"Second test\", \"test3\": \"Third test\"").and_return(true)
105106
Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
106107
run_with({
107108
app_version: '4.0-project',
@@ -112,7 +113,7 @@ def run_with args
112113
end
113114

114115
it "multiple key:value pairs added as a hash" do
115-
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 4.0-project --bundle-version 22 --builder-name josh.edney --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload --metadata \"custom_field_1\"=\"value1\", \"custom_field_2\"=\"value2\"").and_return(true)
116+
expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 4.0-project --bundle-version 22 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository https://github.com/bugsnag/bugsnag-dsym-upload --metadata \"custom_field_1\"=\"value1\", \"custom_field_2\"=\"value2\"").and_return(true)
116117
Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
117118
run_with({
118119
app_version: '4.0-project',

0 commit comments

Comments
 (0)