|
1 | 1 | require 'spec_helper'
|
2 | 2 |
|
3 | 3 | describe Fastlane::Actions::IosUpdateReleaseNotesAction do
|
4 |
| - let(:release_notes_txt) { File.join(File.dirname(__FILE__), 'RELEASE-NOTES.txt') } |
5 |
| - let(:changelog_md) { File.join(File.dirname(__FILE__), 'CHANGELOG.md') } |
6 |
| - |
7 |
| - after do |
8 |
| - FileUtils.rm([release_notes_txt, changelog_md], force: true) |
9 |
| - end |
10 |
| - |
11 | 4 | describe '#ios_update_release_notes' do
|
12 | 5 | it 'adds a new section on RELEASE-NOTES.txt' do
|
13 |
| - # Arrange |
14 |
| - ENV['PROJECT_ROOT_FOLDER'] = File.dirname(__FILE__) |
15 |
| - File.write(release_notes_txt, '') |
16 |
| - |
17 |
| - # Act |
18 |
| - run_described_fastlane_action( |
19 |
| - new_version: '1.0' |
20 |
| - ) |
21 |
| - |
22 |
| - # Assert |
23 |
| - expect(File.read(release_notes_txt)).to eq("1.1\n-----\n\n\n") |
| 6 | + in_tmp_dir do |tmp_dir| |
| 7 | + # Arrange |
| 8 | + ENV['PROJECT_ROOT_FOLDER'] = tmp_dir |
| 9 | + release_notes_txt = File.join(tmp_dir, 'RELEASE-NOTES.txt') |
| 10 | + File.write(release_notes_txt, '') |
| 11 | + |
| 12 | + # Act |
| 13 | + run_described_fastlane_action( |
| 14 | + new_version: '1.0' |
| 15 | + ) |
| 16 | + |
| 17 | + # Assert |
| 18 | + expect(File.read(release_notes_txt)).to eq("1.1\n-----\n\n\n") |
| 19 | + end |
24 | 20 | end
|
25 | 21 |
|
26 | 22 | it 'adds a new section on the given file' do
|
27 |
| - # Arrange |
28 |
| - ENV['PROJECT_ROOT_FOLDER'] = File.dirname(__FILE__) |
29 |
| - File.write(changelog_md, '') |
30 |
| - |
31 |
| - # Act |
32 |
| - run_described_fastlane_action( |
33 |
| - new_version: '1.0', |
34 |
| - release_notes_file_path: changelog_md |
35 |
| - ) |
36 |
| - |
37 |
| - # Assert |
38 |
| - expect(File.read(changelog_md)).to eq("1.1\n-----\n\n\n") |
| 23 | + in_tmp_dir do |tmp_dir| |
| 24 | + # Arrange |
| 25 | + ENV['PROJECT_ROOT_FOLDER'] = tmp_dir |
| 26 | + changelog_md = File.join(tmp_dir, 'CHANGELOG.md') |
| 27 | + File.write(changelog_md, '') |
| 28 | + |
| 29 | + # Act |
| 30 | + run_described_fastlane_action( |
| 31 | + new_version: '1.0', |
| 32 | + release_notes_file_path: changelog_md |
| 33 | + ) |
| 34 | + |
| 35 | + # Assert |
| 36 | + expect(File.read(changelog_md)).to eq("1.1\n-----\n\n\n") |
| 37 | + end |
39 | 38 | end
|
40 | 39 | end
|
41 | 40 | end
|
0 commit comments