Skip to content

Commit 5b3f1ee

Browse files
author
Calum Gilchrist
committed
Add a Test Case for the New Environment Behaviour
1 parent 948db9f commit 5b3f1ee

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

spec/octocatalog-diff/tests/catalog-util/builddir_spec.rb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,41 @@
157157
end
158158
end
159159
end
160+
context 'with --environment' do
161+
context 'with logger' do
162+
it 'should install a symlink to the given environment' do
163+
logger = double('Logger')
164+
165+
@described_object.instance_variable_set(
166+
'@options',
167+
basedir: '/tmp/basedir',
168+
environment: 'baz'
169+
)
170+
171+
expect(@described_object)
172+
.to receive(:install_directory_symlink)
173+
.with(logger, '/tmp/basedir', 'environments/baz')
174+
175+
expect { @described_object.send(:create_symlinks, logger) }.not_to raise_error
176+
end
177+
end
178+
179+
context 'without logger' do
180+
it 'should install default symlink' do
181+
@described_object.instance_variable_set(
182+
'@options',
183+
basedir: '/tmp/basedir',
184+
environment: 'baz'
185+
)
186+
187+
expect(@described_object)
188+
.to receive(:install_directory_symlink)
189+
.with(nil, '/tmp/basedir', 'environments/baz')
190+
191+
expect { @described_object.send(:create_symlinks) }.not_to raise_error
192+
end
193+
end
194+
end
160195

161196
context 'without --create-symlinks or --environment' do
162197
it 'should install directory symlink' do

0 commit comments

Comments
 (0)