File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ describe Fastlane ::Actions ::IosGetAppVersionAction do
4
+ describe 'getting the public app version from the provided .xcconfig file' do
5
+ it 'parses the xcconfig file format correctly and gets the public version' do
6
+ xcconfig_mock_content = <<~CONTENT
7
+ // a comment
8
+ VERSION_SHORT=6
9
+ VERSION_LONG=6.30.0
10
+ CONTENT
11
+
12
+ allow ( File ) . to receive ( :exist? ) . and_return ( true )
13
+
14
+ expect_version ( xcconfig_mock_content : xcconfig_mock_content , expected_version : '6.30' )
15
+ end
16
+
17
+ it 'parses the xcconfig file format correctly and gets the public hotfix version' do
18
+ xcconfig_mock_content = <<~CONTENT
19
+ VERSION_SHORT=6
20
+ // a comment
21
+ VERSION_LONG=6.30.1
22
+ CONTENT
23
+
24
+ allow ( File ) . to receive ( :exist? ) . and_return ( true )
25
+
26
+ expect_version ( xcconfig_mock_content : xcconfig_mock_content , expected_version : '6.30.1' )
27
+ end
28
+
29
+ def expect_version ( xcconfig_mock_content :, expected_version :)
30
+ xcconfig_mock_file_path = File . join ( 'mock' , 'file' , 'path' )
31
+
32
+ allow ( File ) . to receive ( :open ) . with ( xcconfig_mock_file_path , 'r' ) . and_yield ( StringIO . new ( xcconfig_mock_content ) )
33
+
34
+ version_result = run_described_fastlane_action (
35
+ public_version_xcconfig_file : xcconfig_mock_file_path
36
+ )
37
+
38
+ expect ( version_result ) . to eq ( expected_version )
39
+ end
40
+ end
41
+ end
You can’t perform that action at this time.
0 commit comments