Skip to content

Commit 86379ff

Browse files
committed
Add specs
1 parent 0ad462b commit 86379ff

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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

0 commit comments

Comments
 (0)