Skip to content

Commit 8a6d086

Browse files
Moved directory stub and added to registry_spec
1 parent 521d895 commit 8a6d086

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

spec/classes/compose_spec.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
require 'spec_helper'
44

5-
# Stub /tmp_docker dir to prevent shelling out during spec test
6-
class Dir
7-
class << self
8-
def exist?(var)
9-
return true if var == '/tmp_docker'
10-
end
11-
end
12-
end
13-
145
tests = {
156
'with default valus' => {
167
},

spec/classes/init_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@
196196
}
197197
else
198198
it {
199+
# Stub /tmp_docker dir to prevent shelling out during spec test
200+
allow(Dir).to receive(:exist?).and_wrap_original do |original_method, a|
201+
original_method.call(a)
202+
end
203+
204+
allow(Dir).to receive(:exist?).with('/tmp_docker').and_return(true)
199205
is_expected.to contain_class('docker::repos').that_comes_before('Class[docker::install]')
200206
is_expected.to contain_class('docker::install').that_comes_before('Class[docker::config]')
201207
is_expected.to contain_class('docker::config').that_comes_before('Class[docker::service]')

spec/defines/registry_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
require 'spec_helper'
44

5+
# Stub /tmp_docker dir to prevent shelling out during spec test
6+
class Dir
7+
class << self
8+
def exist?(var)
9+
return true if var == '/tmp_docker'
10+
end
11+
end
12+
end
13+
514
tests = {
615
'with ensure => absent' => {
716
'ensure' => 'absent',

spec/unit/lib/puppet/type/docker_compose_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
require 'spec_helper'
44

5+
# Stub /tmp_docker dir to prevent shelling out during spec test
6+
class Dir
7+
class << self
8+
def exist?(var)
9+
return true if var == '/tmp_docker'
10+
end
11+
end
12+
end
13+
514
compose = Puppet::Type.type(:docker_compose)
615

716
describe compose do

0 commit comments

Comments
 (0)