@@ -10,10 +10,10 @@ module CodeOwnership
1010
1111 context 'in an empty application' do
1212 it 'automatically regenerates the codeowners file' do
13- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
14- expect_any_instance_of ( codeowners_validation ) . to receive ( :` ) . with ( "git add #{ Pathname . pwd . join ( '.github/CODEOWNERS' ) } " ) # rubocop:disable RSpec/AnyInstance
13+ expect ( codeowners_path ) . to_not exist
14+ expect_any_instance_of ( codeowners_validation ) . to receive ( :` ) . with ( "git add #{ codeowners_path } " ) # rubocop:disable RSpec/AnyInstance
1515 expect { CodeOwnership . validate! } . to_not raise_error
16- expect ( Pathname . new ( '.github/CODEOWNERS' ) . read ) . to eq <<~EXPECTED
16+ expect ( codeowners_path . read ) . to eq <<~EXPECTED
1717 # STOP! - DO NOT EDIT THIS FILE MANUALLY
1818 # This file was automatically generated by "bin/codeownership validate".
1919 #
@@ -30,10 +30,10 @@ module CodeOwnership
3030 before { create_non_empty_application }
3131
3232 it 'automatically regenerates the codeowners file' do
33- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
34- expect_any_instance_of ( codeowners_validation ) . to receive ( :` ) . with ( "git add #{ Pathname . pwd . join ( '.github/CODEOWNERS' ) } " ) # rubocop:disable RSpec/AnyInstance
33+ expect ( codeowners_path ) . to_not exist
34+ expect_any_instance_of ( codeowners_validation ) . to receive ( :` ) . with ( "git add #{ codeowners_path } " ) # rubocop:disable RSpec/AnyInstance
3535 expect { CodeOwnership . validate! } . to_not raise_error
36- expect ( Pathname . new ( '.github/CODEOWNERS' ) . read ) . to eq <<~EXPECTED
36+ expect ( codeowners_path . read ) . to eq <<~EXPECTED
3737 # STOP! - DO NOT EDIT THIS FILE MANUALLY
3838 # This file was automatically generated by "bin/codeownership validate".
3939 #
@@ -64,10 +64,10 @@ module CodeOwnership
6464
6565 context 'the user has passed in specific input files into the validate method' do
6666 it 'still automatically regenerates the codeowners file, since we look at all files when regenerating CODEOWNERS' do
67- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
68- expect_any_instance_of ( codeowners_validation ) . to receive ( :` ) . with ( "git add #{ Pathname . pwd . join ( '.github/CODEOWNERS' ) } " ) # rubocop:disable RSpec/AnyInstance
67+ expect ( codeowners_path ) . to_not exist
68+ expect_any_instance_of ( codeowners_validation ) . to receive ( :` ) . with ( "git add #{ codeowners_path } " ) # rubocop:disable RSpec/AnyInstance
6969 expect { CodeOwnership . validate! } . to_not raise_error
70- expect ( Pathname . new ( '.github/CODEOWNERS' ) . read ) . to eq <<~EXPECTED
70+ expect ( codeowners_path . read ) . to eq <<~EXPECTED
7171 # STOP! - DO NOT EDIT THIS FILE MANUALLY
7272 # This file was automatically generated by "bin/codeownership validate".
7373 #
@@ -108,10 +108,10 @@ module CodeOwnership
108108 end
109109
110110 it 'does not include the team in the output' do
111- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
111+ expect ( codeowners_path ) . to_not exist
112112 expect { CodeOwnership . validate! } . to_not raise_error
113113 expect_any_instance_of ( codeowners_validation ) . to_not receive ( :` ) # rubocop:disable RSpec/AnyInstance
114- expect ( Pathname . new ( '.github/CODEOWNERS' ) . read ) . to eq <<~EXPECTED
114+ expect ( codeowners_path . read ) . to eq <<~EXPECTED
115115 # STOP! - DO NOT EDIT THIS FILE MANUALLY
116116 # This file was automatically generated by "bin/codeownership validate".
117117 #
@@ -138,10 +138,10 @@ module CodeOwnership
138138 end
139139
140140 it 'does not include the team in the output' do
141- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
141+ expect ( codeowners_path ) . to_not exist
142142 expect { CodeOwnership . validate! } . to_not raise_error
143143 expect_any_instance_of ( codeowners_validation ) . to_not receive ( :` ) # rubocop:disable RSpec/AnyInstance
144- expect ( Pathname . new ( '.github/CODEOWNERS' ) . read ) . to eq <<~EXPECTED
144+ expect ( codeowners_path . read ) . to eq <<~EXPECTED
145145 # STOP! - DO NOT EDIT THIS FILE MANUALLY
146146 # This file was automatically generated by "bin/codeownership validate".
147147 #
@@ -161,10 +161,10 @@ module CodeOwnership
161161 end
162162
163163 it 'does not stage the changes to the codeowners file' do
164- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
164+ expect ( codeowners_path ) . to_not exist
165165 expect_any_instance_of ( codeowners_validation ) . to_not receive ( :` ) # rubocop:disable RSpec/AnyInstance
166166 expect { CodeOwnership . validate! ( stage_changes : false ) } . to_not raise_error
167- expect ( Pathname . new ( '.github/CODEOWNERS' ) . read ) . to eq <<~EXPECTED
167+ expect ( codeowners_path . read ) . to eq <<~EXPECTED
168168 # STOP! - DO NOT EDIT THIS FILE MANUALLY
169169 # This file was automatically generated by "bin/codeownership validate".
170170 #
@@ -185,7 +185,7 @@ module CodeOwnership
185185
186186 context 'in an empty application' do
187187 it 'automatically regenerates the codeowners file' do
188- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
188+ expect ( codeowners_path ) . to_not exist
189189 expect_any_instance_of ( codeowners_validation ) . to_not receive ( :` ) # rubocop:disable RSpec/AnyInstance
190190 expect { CodeOwnership . validate! ( autocorrect : false ) } . to raise_error do |e |
191191 expect ( e ) . to be_a CodeOwnership ::InvalidCodeOwnershipConfigurationError
@@ -196,15 +196,15 @@ module CodeOwnership
196196 See https://github.com/rubyatscale/code_ownership#README.md for more details
197197 EXPECTED
198198 end
199- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
199+ expect ( codeowners_path ) . to_not exist
200200 end
201201 end
202202
203203 context 'in an non-empty application' do
204204 before { create_non_empty_application }
205205
206206 it 'automatically regenerates the codeowners file' do
207- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
207+ expect ( codeowners_path ) . to_not exist
208208 expect_any_instance_of ( codeowners_validation ) . to_not receive ( :` ) # rubocop:disable RSpec/AnyInstance
209209 expect { CodeOwnership . validate! ( autocorrect : false ) } . to raise_error do |e |
210210 expect ( e ) . to be_a CodeOwnership ::InvalidCodeOwnershipConfigurationError
@@ -215,7 +215,7 @@ module CodeOwnership
215215 See https://github.com/rubyatscale/code_ownership#README.md for more details
216216 EXPECTED
217217 end
218- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
218+ expect ( codeowners_path ) . to_not exist
219219 end
220220
221221 context 'team does not have a github team listed' do
@@ -229,7 +229,7 @@ module CodeOwnership
229229 end
230230
231231 it 'does not include the team in the output' do
232- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
232+ expect ( codeowners_path ) . to_not exist
233233 expect_any_instance_of ( codeowners_validation ) . to_not receive ( :` ) # rubocop:disable RSpec/AnyInstance
234234 expect { CodeOwnership . validate! ( autocorrect : false ) } . to raise_error do |e |
235235 expect ( e ) . to be_a CodeOwnership ::InvalidCodeOwnershipConfigurationError
@@ -240,7 +240,7 @@ module CodeOwnership
240240 See https://github.com/rubyatscale/code_ownership#README.md for more details
241241 EXPECTED
242242 end
243- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
243+ expect ( codeowners_path ) . to_not exist
244244 end
245245 end
246246
@@ -258,7 +258,7 @@ module CodeOwnership
258258 end
259259
260260 it 'does not include the team in the output' do
261- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
261+ expect ( codeowners_path ) . to_not exist
262262 expect_any_instance_of ( codeowners_validation ) . to_not receive ( :` ) # rubocop:disable RSpec/AnyInstance
263263 expect { CodeOwnership . validate! ( autocorrect : false ) } . to raise_error do |e |
264264 expect ( e ) . to be_a CodeOwnership ::InvalidCodeOwnershipConfigurationError
@@ -269,7 +269,7 @@ module CodeOwnership
269269 See https://github.com/rubyatscale/code_ownership#README.md for more details
270270 EXPECTED
271271 end
272- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
272+ expect ( codeowners_path ) . to_not exist
273273 end
274274 end
275275 end
@@ -279,7 +279,7 @@ module CodeOwnership
279279
280280 it 'prints out the diff' do
281281 FileUtils . mkdir ( '.github' )
282- Pathname . new ( '.github/CODEOWNERS' ) . write <<~CODEOWNERS
282+ codeowners_path . write <<~CODEOWNERS
283283 # STOP! - DO NOT EDIT THIS FILE MANUALLY
284284 # This file was automatically generated by "bin/codeownership validate".
285285 #
@@ -335,7 +335,7 @@ module CodeOwnership
335335
336336 it 'prints out the diff' do
337337 FileUtils . mkdir ( '.github' )
338- Pathname . new ( '.github/CODEOWNERS' ) . write <<~CODEOWNERS
338+ codeowners_path . write <<~CODEOWNERS
339339 # STOP! - DO NOT EDIT THIS FILE MANUALLY
340340 # This file was automatically generated by "bin/codeownership validate".
341341 #
@@ -388,7 +388,7 @@ module CodeOwnership
388388
389389 it 'prints out the diff' do
390390 FileUtils . mkdir ( '.github' )
391- Pathname . new ( '.github/CODEOWNERS' ) . write <<~CODEOWNERS
391+ codeowners_path . write <<~CODEOWNERS
392392 # STOP! - DO NOT EDIT THIS FILE MANUALLY
393393 # This file was automatically generated by "bin/codeownership validate".
394394 #
@@ -443,10 +443,10 @@ module CodeOwnership
443443 end
444444
445445 it 'skips validating the codeowners file' do
446- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
446+ expect ( codeowners_path ) . to_not exist
447447 expect_any_instance_of ( codeowners_validation ) . to_not receive ( :` ) # rubocop:disable RSpec/AnyInstance
448448 expect { CodeOwnership . validate! ( autocorrect : false ) } . to_not raise_error
449- expect ( Pathname . new ( '.github/CODEOWNERS' ) ) . to_not exist
449+ expect ( codeowners_path ) . to_not exist
450450 end
451451 end
452452 end
0 commit comments