66
77BuildAction = Fastlane ::Actions ::SendBuildToBugsnagAction
88BUGSNAG_CLI_PATH = BugsnagCli . get_bundled_path
9+ GIT_REVISION = `git rev-parse HEAD` . strip
10+ BUILDER = `whoami` . strip
911
1012
1113describe BuildAction do
@@ -15,7 +17,7 @@ def run_with args
1517
1618 context 'building an iOS project' do
1719 it 'detects default Info.plist file excluding test dirs' do
18- 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 3a30a510ba898341ff8631da49dc7021fb28c40e --repository git@ github.com: bugsnag/bugsnag-dsym-upload.git " ) . 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 )
1921 Dir . chdir ( File . join ( FIXTURE_PATH , 'ios_proj' ) ) do
2022 run_with ( { } )
2123 end
@@ -24,7 +26,7 @@ def run_with args
2426 it 'reads api key from legacy location' do
2527 # the API key is now in `bugsnag.apiKey`, it used to be in 'BugsnagAPIKey',
2628 # test this can be extracted correctly from the `ios_proj_legacy`
27- 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 3a30a510ba898341ff8631da49dc7021fb28c40e --repository git@ github.com: bugsnag/bugsnag-dsym-upload.git " ) . 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 )
2830 Dir . chdir ( File . join ( FIXTURE_PATH , 'ios_proj_legacy' ) ) do
2931 run_with ( { } )
3032 end
@@ -33,7 +35,7 @@ def run_with args
3335 context 'using default config_file option' do
3436 context 'override API key from config' do
3537 it 'reads API key from the api_key option' do
36- 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 3a30a510ba898341ff8631da49dc7021fb28c40e --repository git@ github.com: bugsnag/bugsnag-dsym-upload.git " ) . 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 )
3739 Dir . chdir ( File . join ( FIXTURE_PATH , 'ios_proj' ) ) do
3840 run_with ( {
3941 api_key : '12345678901234567890123456789FFF'
@@ -42,7 +44,7 @@ def run_with args
4244 end
4345
4446 it 'uses input versions from options' do
45- 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 3a30a510ba898341ff8631da49dc7021fb28c40e --repository git@ github.com: bugsnag/bugsnag-dsym-upload.git " ) . 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 )
4648 Dir . chdir ( File . join ( FIXTURE_PATH , 'ios_proj' ) ) do
4749 run_with ( {
4850 app_version : '8.0.0' ,
@@ -55,7 +57,7 @@ def run_with args
5557
5658 context 'override config_file option' do
5759 it 'reads API key and version info from the config file' do
58- 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 3a30a510ba898341ff8631da49dc7021fb28c40e --repository git@ github.com: bugsnag/bugsnag-dsym-upload.git " ) . 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 )
5961 Dir . chdir ( File . join ( FIXTURE_PATH , 'ios_proj' ) ) do
6062 run_with ( {
6163 config_file : File . join ( 'Project' , 'Info.plist' )
@@ -65,7 +67,7 @@ def run_with args
6567
6668 context 'override API key, and config file' do
6769 it 'uses the input api_key to override a non default config' do
68- 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 3a30a510ba898341ff8631da49dc7021fb28c40e --repository git@ github.com: bugsnag/bugsnag-dsym-upload.git " ) . 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 )
6971 Dir . chdir ( File . join ( FIXTURE_PATH , 'ios_proj' ) ) do
7072 run_with ( {
7173 config_file : File . join ( 'Project' , 'Info.plist' ) ,
@@ -75,7 +77,7 @@ def run_with args
7577 end
7678
7779 it 'uses the input versions to override a non default config' do
78- 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 3a30a510ba898341ff8631da49dc7021fb28c40e --repository git@ github.com: bugsnag/bugsnag-dsym-upload.git " ) . 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 )
7981 Dir . chdir ( File . join ( FIXTURE_PATH , 'ios_proj' ) ) do
8082 run_with ( {
8183 config_file : File . join ( 'Project' , 'Info.plist' ) ,
@@ -89,7 +91,7 @@ def run_with args
8991
9092 context 'metadata added to args' do
9193 it "single key:value pair added" do
92- 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 3a30a510ba898341ff8631da49dc7021fb28c40e --repository git@ github.com: bugsnag/bugsnag-dsym-upload.git --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 )
9395 Dir . chdir ( File . join ( FIXTURE_PATH , 'ios_proj' ) ) do
9496 run_with ( {
9597 app_version : '4.0-project' ,
@@ -100,7 +102,7 @@ def run_with args
100102 end
101103
102104 it "multiple key:value pairs added" do
103- 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 3a30a510ba898341ff8631da49dc7021fb28c40e --repository git@ github.com: bugsnag/bugsnag-dsym-upload.git --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 )
104106 Dir . chdir ( File . join ( FIXTURE_PATH , 'ios_proj' ) ) do
105107 run_with ( {
106108 app_version : '4.0-project' ,
@@ -111,7 +113,7 @@ def run_with args
111113 end
112114
113115 it "multiple key:value pairs added as a hash" do
114- 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 3a30a510ba898341ff8631da49dc7021fb28c40e --repository git@ github.com: bugsnag/bugsnag-dsym-upload.git --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 )
115117 Dir . chdir ( File . join ( FIXTURE_PATH , 'ios_proj' ) ) do
116118 run_with ( {
117119 app_version : '4.0-project' ,
0 commit comments