|
14 | 14 |
|
15 | 15 | context 'without arguments' do |
16 | 16 | it 'shows long usage' do |
17 | | - expect { subject.execute %w[add] }.to output_approval('cli/generate/usage') |
| 17 | + expect { subject.execute %w[add] }.to output_approval('cli/add/usage') |
18 | 18 | end |
19 | 19 | end |
20 | 20 |
|
21 | 21 | context 'with colors command' do |
22 | 22 | let(:lib_file) { "#{source_dir}/lib/colors.sh" } |
23 | 23 |
|
24 | | - before do |
25 | | - reset_tmp_dir create_src: true |
26 | | - end |
| 24 | + before { reset_tmp_dir create_src: true } |
27 | 25 |
|
28 | 26 | it 'copies the colors.sh lib file to the user space' do |
29 | 27 | expect { subject.execute %w[add colors] }.to output_approval('cli/add/colors') |
|
32 | 30 | end |
33 | 31 |
|
34 | 32 | context 'with comp command' do |
35 | | - before do |
36 | | - reset_tmp_dir init: true |
37 | | - end |
| 33 | + before { reset_tmp_dir init: true } |
38 | 34 |
|
39 | 35 | context 'with yaml subcommand' do |
40 | 36 | it 'creates completions.yml' do |
|
67 | 63 | context 'with config command' do |
68 | 64 | let(:lib_file) { "#{source_dir}/lib/config.sh" } |
69 | 65 |
|
70 | | - before do |
71 | | - reset_tmp_dir create_src: true |
72 | | - end |
| 66 | + before { reset_tmp_dir create_src: true } |
73 | 67 |
|
74 | 68 | it 'copies the config.sh lib file to the user space' do |
75 | 69 | expect { subject.execute %w[add config] }.to output_approval('cli/add/config') |
|
80 | 74 | context 'with help command' do |
81 | 75 | let(:help_command_file) { "#{source_dir}/help_command.sh" } |
82 | 76 |
|
83 | | - before do |
84 | | - reset_tmp_dir init: true |
85 | | - end |
| 77 | + before { reset_tmp_dir init: true } |
86 | 78 |
|
87 | 79 | it 'copies the help_command.sh lib file to the user space' do |
88 | 80 | expect { subject.execute %w[add help] }.to output_approval('cli/add/help_command') |
|
93 | 85 | context 'with lib command' do |
94 | 86 | let(:lib_file) { "#{source_dir}/lib/sample_function.sh" } |
95 | 87 |
|
96 | | - before do |
97 | | - reset_tmp_dir create_src: true |
98 | | - end |
| 88 | + before { reset_tmp_dir create_src: true } |
99 | 89 |
|
100 | 90 | it 'copies a sample function to the user space under lib directory' do |
101 | 91 | expect { subject.execute %w[add lib] }.to output_approval('cli/add/lib') |
|
107 | 97 | let(:settings_file) { "#{target_dir}/settings.yml" } |
108 | 98 | let(:template_file) { 'lib/bashly/templates/settings.yml' } |
109 | 99 |
|
110 | | - before do |
111 | | - reset_tmp_dir |
112 | | - end |
| 100 | + before { reset_tmp_dir } |
113 | 101 |
|
114 | 102 | it 'copies the settings file to the current directory' do |
115 | 103 | expect do |
|
136 | 124 | context 'with strings command' do |
137 | 125 | let(:strings_file) { "#{source_dir}/bashly-strings.yml" } |
138 | 126 |
|
139 | | - before do |
140 | | - reset_tmp_dir create_src: true |
141 | | - end |
| 127 | + before { reset_tmp_dir create_src: true } |
142 | 128 |
|
143 | 129 | it 'copies the strings configuration to the user space' do |
144 | 130 | expect { subject.execute %w[add strings] }.to output_approval('cli/add/strings') |
145 | 131 | expect(File).to exist(strings_file) |
146 | 132 | end |
147 | 133 |
|
148 | 134 | context 'when the source directory does not exist' do |
149 | | - before do |
150 | | - reset_tmp_dir |
151 | | - end |
| 135 | + before { reset_tmp_dir } |
152 | 136 |
|
153 | 137 | it 'raises an error' do |
154 | 138 | expect { subject.execute %w[add strings] }.to raise_error(InitError, /does not exist/) |
|
166 | 150 | context 'with test command' do |
167 | 151 | let(:lib_file) { "#{target_dir}/test/approvals.bash" } |
168 | 152 |
|
169 | | - before do |
170 | | - reset_tmp_dir create_src: true |
171 | | - end |
| 153 | + before { reset_tmp_dir create_src: true } |
172 | 154 |
|
173 | 155 | it 'copies the test folder to the user space' do |
174 | 156 | expect { subject.execute %w[add test] }.to output_approval('cli/add/test') |
|
179 | 161 | context 'with validations command' do |
180 | 162 | let(:lib_file) { "#{source_dir}/lib/validations/validate_integer.sh" } |
181 | 163 |
|
182 | | - before do |
183 | | - reset_tmp_dir create_src: true |
184 | | - end |
| 164 | + before { reset_tmp_dir create_src: true } |
185 | 165 |
|
186 | 166 | it 'copies the validation lib folder to the user space' do |
187 | 167 | expect { subject.execute %w[add validations] }.to output_approval('cli/add/validations') |
|
192 | 172 | context 'with yaml command' do |
193 | 173 | let(:lib_file) { "#{source_dir}/lib/yaml.sh" } |
194 | 174 |
|
195 | | - before do |
196 | | - reset_tmp_dir create_src: true |
197 | | - end |
| 175 | + before { reset_tmp_dir create_src: true } |
198 | 176 |
|
199 | 177 | it 'copies the yaml.sh lib file to the user space' do |
200 | 178 | expect { subject.execute %w[add yaml] }.to output_approval('cli/add/yaml') |
|
0 commit comments