11require 'spec_helper'
22require 'json'
33require 'fastlane/actions/get_info_plist_value'
4+ require_relative '../lib/fastlane/plugin/bugsnag/actions/bundled_cli_path'
5+
46
57BuildAction = Fastlane ::Actions ::SendBuildToBugsnagAction
8+ BUGSNAG_CLI_PATH = BundledCli . get_path
9+
610
711describe BuildAction do
812 def run_with args
@@ -11,10 +15,10 @@ def run_with args
1115
1216 context 'building an iOS project' do
1317 it 'detects default Info.plist file excluding test dirs' do
14- expect ( BuildAction ) . to receive ( :send_notification ) do |url , body |
18+ expect ( BuildAction ) . to receive ( :send_notification ) do |cli_path , body |
1519 payload = ::JSON . load ( body )
16- expect ( payload [ 'appVersion ' ] ) . to eq '2.0-other'
17- expect ( payload [ 'appBundleVersion ' ] ) . to eq '22'
20+ expect ( payload [ 'versionName ' ] ) . to eq '2.0-other'
21+ expect ( payload [ 'bundleVersion ' ] ) . to eq '22'
1822 expect ( payload [ 'apiKey' ] ) . to eq '12345678901234567890123456789AAA'
1923 end
2024
@@ -28,8 +32,8 @@ def run_with args
2832 # test this can be extracted correctly from the `ios_proj_legacy`
2933 expect ( BuildAction ) . to receive ( :send_notification ) do |url , body |
3034 payload = ::JSON . load ( body )
31- expect ( payload [ 'appVersion ' ] ) . to eq '4.0-project'
32- expect ( payload [ 'appBundleVersion ' ] ) . to eq '44'
35+ expect ( payload [ 'versionName ' ] ) . to eq '4.0-project'
36+ expect ( payload [ 'bundleVersion ' ] ) . to eq '44'
3337 expect ( payload [ 'apiKey' ] ) . to eq '12345678901234567890123456789BBB'
3438 end
3539
@@ -56,8 +60,8 @@ def run_with args
5660 it 'uses input versions from options' do
5761 expect ( BuildAction ) . to receive ( :send_notification ) do |url , body |
5862 payload = ::JSON . load ( body )
59- expect ( payload [ 'appVersion ' ] ) . to eq '8.0.0'
60- expect ( payload [ 'appBundleVersion ' ] ) . to eq '800'
63+ expect ( payload [ 'versionName ' ] ) . to eq '8.0.0'
64+ expect ( payload [ 'bundleVersion ' ] ) . to eq '800'
6165 end
6266
6367 Dir . chdir ( File . join ( FIXTURE_PATH , 'ios_proj' ) ) do
@@ -74,8 +78,8 @@ def run_with args
7478 it 'reads API key and version info from the config file' do
7579 expect ( BuildAction ) . to receive ( :send_notification ) do |url , body |
7680 payload = ::JSON . load ( body )
77- expect ( payload [ 'appVersion ' ] ) . to eq '3.0-project'
78- expect ( payload [ 'appBundleVersion ' ] ) . to eq '33'
81+ expect ( payload [ 'versionName ' ] ) . to eq '3.0-project'
82+ expect ( payload [ 'bundleVersion ' ] ) . to eq '33'
7983 expect ( payload [ 'apiKey' ] ) . to eq '12345678901234567890123456789DDD'
8084 end
8185
@@ -90,8 +94,8 @@ def run_with args
9094 it 'uses the input api_key to override a non default config' do
9195 expect ( BuildAction ) . to receive ( :send_notification ) do |url , body |
9296 payload = ::JSON . load ( body )
93- expect ( payload [ 'appVersion ' ] ) . to eq '3.0-project'
94- expect ( payload [ 'appBundleVersion ' ] ) . to eq '33'
97+ expect ( payload [ 'versionName ' ] ) . to eq '3.0-project'
98+ expect ( payload [ 'bundleVersion ' ] ) . to eq '33'
9599 expect ( payload [ 'apiKey' ] ) . to eq '12345678901234567890123456789EEE'
96100 end
97101
@@ -106,8 +110,8 @@ def run_with args
106110 it 'uses the input versions to override a non default config' do
107111 expect ( BuildAction ) . to receive ( :send_notification ) do |url , body |
108112 payload = ::JSON . load ( body )
109- expect ( payload [ 'appVersion ' ] ) . to eq '9.0.0'
110- expect ( payload [ 'appBundleVersion ' ] ) . to eq '900'
113+ expect ( payload [ 'versionName ' ] ) . to eq '9.0.0'
114+ expect ( payload [ 'bundleVersion ' ] ) . to eq '900'
111115 expect ( payload [ 'apiKey' ] ) . to eq '12345678901234567890123456789DDD'
112116 end
113117
@@ -126,7 +130,7 @@ def run_with args
126130 it "single key:value pair added" do
127131 expect ( BuildAction ) . to receive ( :send_notification ) do |url , body |
128132 payload = ::JSON . load ( body )
129- expect ( payload [ 'appVersion ' ] ) . to eq '4.0-project'
133+ expect ( payload [ 'versionName ' ] ) . to eq '4.0-project'
130134 expect ( payload [ 'apiKey' ] ) . to eq '12345678901234567890123456789DDD'
131135 expect ( payload [ 'metadata' ] ) . to eq '"test1": "First test"'
132136 end
@@ -139,11 +143,11 @@ def run_with args
139143 } )
140144 end
141145 end
142-
146+
143147 it "multiple key:value pairs added" do
144148 expect ( BuildAction ) . to receive ( :send_notification ) do |url , body |
145149 payload = ::JSON . load ( body )
146- expect ( payload [ 'appVersion ' ] ) . to eq '4.0-project'
150+ expect ( payload [ 'versionName ' ] ) . to eq '4.0-project'
147151 expect ( payload [ 'apiKey' ] ) . to eq '12345678901234567890123456789DDD'
148152 expect ( payload [ 'metadata' ] ) . to eq '"test1": "First test", "test2": "Second test", "test3": "Third test"'
149153 end
0 commit comments