Skip to content

Commit 9d70936

Browse files
author
Calum Gilchrist
committed
Update Catalog Compute Spec for Environments Behaviour
1 parent 1237ef8 commit 9d70936

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

spec/octocatalog-diff/tests/catalog/computed_spec.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,17 +422,19 @@
422422
context 'when preserve_environments is not set' do
423423
context 'and environment is specified' do
424424
it 'should return without raising error when directory exists' do
425-
allow(File).to receive(:"directory?").with('/tmp/assert/environments/production').and_return(true)
425+
allow(File).to receive(:"directory?").with('/tmp/assert/environments/production').and_return(false)
426+
allow(File).to receive(:"directory?").with('/tmp/assert/environments/custom').and_return(true)
426427
described_object = described_class.allocate
427-
described_object.instance_variable_set('@opts', environment: 'nope')
428+
described_object.instance_variable_set('@opts', environment: 'custom')
428429
described_object.instance_variable_set('@builddir', OpenStruct.new(tempdir: '/tmp/assert'))
429430
expect { described_object.send(:assert_that_puppet_environment_directory_exists) }.not_to raise_error
430431
end
431432

432433
it 'should raise Errno::ENOENT when directory does not exist' do
433-
allow(File).to receive(:"directory?").with('/tmp/assert/environments/production').and_return(false)
434+
allow(File).to receive(:"directory?").with('/tmp/assert/environments/production').and_return(true)
435+
allow(File).to receive(:"directory?").with('/tmp/assert/environments/custom').and_return(false)
434436
described_object = described_class.allocate
435-
described_object.instance_variable_set('@opts', environment: 'yup')
437+
described_object.instance_variable_set('@opts', environment: 'custom')
436438
described_object.instance_variable_set('@builddir', OpenStruct.new(tempdir: '/tmp/assert'))
437439
expect { described_object.send(:assert_that_puppet_environment_directory_exists) }.to raise_error(Errno::ENOENT)
438440
end

0 commit comments

Comments
 (0)