Skip to content

Commit 4d20f7c

Browse files
committed
update rspec tests
1 parent 47084c6 commit 4d20f7c

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

tools/fastlane-plugin/lib/fastlane/plugin/bugsnag/actions/bundled_cli_path.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ def self.get_path
1919
else
2020
if host_cpu =~ /arm|aarch64/
2121
self.bin_folder('arm64-linux-bugsnag-cli')
22-
else if OS.bits == 64
23-
self.bin_folder('x86_64-linux-bugsnag-cli')
24-
else
25-
self.bin_folder('i386-linux-bugsnag-cli')
26-
end
22+
elsif OS.bits == 64
23+
self.bin_folder('x86_64-linux-bugsnag-cli')
24+
else
25+
self.bin_folder('i386-linux-bugsnag-cli')
2726
end
2827
end
2928
end

tools/fastlane-plugin/spec/bugsnag_upload_dsym_action_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
require 'spec_helper'
2+
require_relative '../lib/fastlane/plugin/bugsnag/actions/bundled_cli_path'
23

34
Action = Fastlane::Actions::UploadSymbolsToBugsnagAction
4-
BUGSNAG_CLI_PATH = Action::bundled_bugsnag_cli_path
5+
BUGSNAG_CLI_PATH = BundledCli.get_path
56

67
describe Action do
78
def run_with args

tools/fastlane-plugin/spec/send_build_to_bugsnag_spec.rb

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
require 'spec_helper'
22
require 'json'
33
require 'fastlane/actions/get_info_plist_value'
4+
require_relative '../lib/fastlane/plugin/bugsnag/actions/bundled_cli_path'
5+
46

57
BuildAction = Fastlane::Actions::SendBuildToBugsnagAction
8+
BUGSNAG_CLI_PATH = BundledCli.get_path
9+
610

711
describe 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

Comments
 (0)