File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
spec/lib/code_ownership/private Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ module CodeOwnership
2+ RSpec . describe Private ::CodeownersFile do
3+ describe '.path' do
4+ subject { described_class . path }
5+
6+ context 'when the environment variable is set' do
7+ before do
8+ allow ( ENV ) . to receive ( :fetch ) . and_call_original
9+ allow ( ENV ) . to receive ( :fetch ) . with ( 'CODEOWNERS_PATH' , anything ) . and_return ( path )
10+ end
11+
12+ context "to 'foo'" do
13+ let ( :path ) { 'foo' }
14+
15+ it 'uses the environment variable' do
16+ expect ( subject ) . to eq ( Pathname . pwd . join ( 'foo' , 'CODEOWNERS' ) )
17+ end
18+ end
19+
20+ context 'to empty' do
21+ let ( :path ) { '' }
22+
23+ it 'uses the environment variable' do
24+ expect ( subject ) . to eq ( Pathname . pwd . join ( 'CODEOWNERS' ) )
25+ end
26+ end
27+ end
28+
29+ context 'when the environment variable is not set' do
30+ it 'uses the default' do
31+ expect ( subject ) . to eq ( Pathname . pwd . join ( '.github' , 'CODEOWNERS' ) )
32+ end
33+ end
34+ end
35+ end
36+ end
You can’t perform that action at this time.
0 commit comments