|
1 | | -describe Fastlane do |
2 | | - describe Fastlane::FastFile do |
3 | | - let(:test_data_dir) { File.join(File.dirname(__FILE__), 'test-data', 'translations', 'ios_l10n_helper') } |
| 1 | +describe Fastlane::Actions::IosMergeStringsFilesAction do |
| 2 | + let(:test_data_dir) { File.join(File.dirname(__FILE__), 'test-data', 'translations', 'ios_l10n_helper') } |
4 | 3 |
|
5 | | - def fixture(name) |
6 | | - File.join(test_data_dir, name) |
7 | | - end |
8 | | - |
9 | | - describe '#ios_merge_strings_files' do |
10 | | - it 'calls the action with the proper parameters and warn and return duplicate keys' do |
11 | | - # Arrange |
12 | | - messages = [] |
13 | | - allow(FastlaneCore::UI).to receive(:important) do |message| |
14 | | - messages.append(message) |
15 | | - end |
16 | | - inputs = ['Localizable-utf16.strings', 'non-latin-utf16.strings'] |
| 4 | + def fixture(name) |
| 5 | + File.join(test_data_dir, name) |
| 6 | + end |
17 | 7 |
|
18 | | - Dir.mktmpdir('a8c-release-toolkit-tests-') do |tmpdir| |
19 | | - inputs.each { |f| FileUtils.cp(fixture(f), tmpdir) } |
| 8 | + describe '#ios_merge_strings_files' do |
| 9 | + it 'calls the action with the proper parameters and warn and return duplicate keys' do |
| 10 | + # Arrange |
| 11 | + messages = [] |
| 12 | + allow(FastlaneCore::UI).to receive(:important) do |message| |
| 13 | + messages.append(message) |
| 14 | + end |
| 15 | + inputs = ['Localizable-utf16.strings', 'non-latin-utf16.strings'] |
20 | 16 |
|
21 | | - # Act |
22 | | - result = Dir.chdir(tmpdir) do |
23 | | - described_class.new.parse("lane :test do |
24 | | - ios_merge_strings_files( |
25 | | - paths: ['#{inputs[0]}', '#{inputs[1]}'], |
26 | | - destination: 'output.strings' |
27 | | - ) |
28 | | - end").runner.execute(:test) |
29 | | - end |
| 17 | + Dir.mktmpdir('a8c-release-toolkit-tests-') do |tmpdir| |
| 18 | + inputs.each { |f| FileUtils.cp(fixture(f), tmpdir) } |
30 | 19 |
|
31 | | - # Assert |
32 | | - expect(File).to exist(File.join(tmpdir, 'output.strings')) |
33 | | - expect(result).to eq(%w[key1 key2]) |
34 | | - expect(messages).to eq([ |
35 | | - 'Duplicate key found while merging the `.strings` files: `key1`', |
36 | | - 'Duplicate key found while merging the `.strings` files: `key2`', |
37 | | - ]) |
| 20 | + # Act |
| 21 | + result = Dir.chdir(tmpdir) do |
| 22 | + run_described_fastlane_action( |
| 23 | + paths: [inputs[0], inputs[1]], |
| 24 | + destination: 'output.strings' |
| 25 | + ) |
38 | 26 | end |
| 27 | + |
| 28 | + # Assert |
| 29 | + expect(File).to exist(File.join(tmpdir, 'output.strings')) |
| 30 | + expect(result).to eq(%w[key1 key2]) |
| 31 | + expect(messages).to eq( |
| 32 | + [ |
| 33 | + 'Duplicate key found while merging the `.strings` files: `key1`', |
| 34 | + 'Duplicate key found while merging the `.strings` files: `key2`', |
| 35 | + ] |
| 36 | + ) |
39 | 37 | end |
40 | 38 | end |
41 | 39 | end |
|
0 commit comments