control_spec_helper 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -1
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +13 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile.lock +109 -0
  7. data/Rakefile +87 -8
  8. data/control_spec_helper.gemspec +22 -15
  9. data/ext/spec_helper_control.rb +8 -5
  10. data/lib/control_spec_helper/control_spec_helper.rb +49 -32
  11. data/lib/control_spec_helper/rake_tasks.rb +1 -157
  12. data/lib/control_spec_helper/version.rb +1 -1
  13. data/lib/rake_tasks.rb +4 -0
  14. data/lib/slalom.rb +60 -0
  15. data/lib/tasks/acceptance.rake +26 -0
  16. data/lib/tasks/apply.rake +7 -0
  17. data/lib/tasks/apply_debug.rake +7 -0
  18. data/lib/tasks/apply_dev.rake +7 -0
  19. data/lib/tasks/apply_noop.rake +6 -0
  20. data/lib/tasks/apply_standalone.rake +7 -0
  21. data/lib/tasks/default.rake +3 -0
  22. data/lib/tasks/git.rake +9 -0
  23. data/lib/tasks/help.rake +6 -0
  24. data/lib/tasks/hooks.rake +11 -0
  25. data/lib/tasks/lint.rake +26 -0
  26. data/lib/tasks/puppet_cmd.rake +6 -0
  27. data/lib/tasks/r10k.rake +6 -0
  28. data/lib/tasks/serverspec.rake +10 -0
  29. data/lib/tasks/spec.rake +10 -0
  30. data/lib/tasks/spec_clean.rake +6 -0
  31. data/lib/tasks/spec_prep.rake +10 -0
  32. data/lib/tasks/vplugins.rake +9 -0
  33. data/spec/spec_helper.rb +11 -0
  34. data/spec/support/shared_contexts/rake.rb +26 -0
  35. data/spec/tasks/vplugins_spec.rb +71 -0
  36. data/spec/unit/class_from_path_spec.rb +62 -0
  37. data/spec/unit/control_spec_helper_spec.rb +62 -1
  38. data/spec/unit/debug_spec.rb +30 -0
  39. data/spec/unit/diff_from_base_spec.rb +34 -0
  40. data/spec/unit/diff_profile_spec.rb +38 -0
  41. data/spec/unit/diff_roles_spec.rb +38 -0
  42. data/spec/unit/profile_fixtures_spec.rb +185 -0
  43. data/spec/unit/project_root_spec.rb +45 -0
  44. data/spec/unit/r10k_spec.rb +58 -0
  45. data/spec/unit/spec_clean_spec.rb +137 -0
  46. data/spec/unit/spec_from_class_spec.rb +65 -0
  47. metadata +148 -30
@@ -0,0 +1,26 @@
1
+ require 'rake'
2
+ require 'English'
3
+ require './lib/slalom'
4
+
5
+ shared_context 'rake' do
6
+ Dir.chdir('fixtures/puppet-control') do
7
+ let(:rake) { Rake::Application.new }
8
+ let(:task_name) { self.class.top_level_description }
9
+ let(:task_path) { "lib/tasks/#{task_name.split(':').first}" }
10
+ let(:ssh_config) { vagrant_ssh_config }
11
+ subject { rake[task_name] }
12
+
13
+ def loaded_files_excluding_current_rake_file
14
+ $LOADED_FEATURES.reject do |file|
15
+ file == Rails_root.join("#{task_path}.rake").to_s
16
+ end
17
+ end
18
+
19
+ before do
20
+ Rake.application = rake
21
+ Rake.application.rake_require(
22
+ task_path, [Rails_root.to_s], loaded_files_excluding_current_rake_file
23
+ )
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,71 @@
1
+ require 'spec_helper'
2
+ require 'net/ssh'
3
+
4
+ @config = nil
5
+ @original_dir = nil
6
+ @ssh = nil
7
+
8
+ describe :vplugins do
9
+ include_context 'rake'
10
+
11
+ before(:all) do
12
+ @original_dir = Dir.pwd
13
+ Dir.chdir('fixtures/puppet-control')
14
+ end
15
+
16
+ after(:all) do
17
+ Dir.chdir(@original_dir)
18
+ end
19
+
20
+ context 'when run on CentOS 7' do
21
+ cached_env_debug = ''
22
+ original_stderr = $stderr
23
+ original_stdout = $stdout
24
+
25
+ let(:conf) { ssh_config }
26
+
27
+ before(:each) do
28
+ $stderr = File.open(File::NULL, 'w')
29
+ $stdout = File.open(File::NULL, 'w')
30
+ end
31
+
32
+ after(:each) do
33
+ $stderr = original_stderr
34
+ $stdout = original_stdout
35
+ end
36
+
37
+ it 'should install successfully' do
38
+ expect(Net::SSH.start(
39
+ conf['HostName'],
40
+ conf['User'],
41
+ port: conf['Port'],
42
+ password: 'vagrant'
43
+ ) do |ssh|
44
+ ssh_exec!(ssh,
45
+ 'cd /vagrant && unset RUBYLIB ; bundle exec rake vplugins')
46
+ end[2]).to eq(0)
47
+ end
48
+
49
+ it 'should install the vagrant-auto_network plugin' do
50
+ expect(Net::SSH.start(
51
+ conf['HostName'],
52
+ conf['User'],
53
+ port: conf['Port'],
54
+ password: 'vagrant'
55
+ ) do |ssh|
56
+ ssh_exec!(ssh, 'unset RUBYLIB ; vagrant plugin list')
57
+ end[0].split("\n")).to include(/vagrant-auto_network/)
58
+ end
59
+
60
+ it 'should install the vagrant-hosts plugin' do
61
+ expect(Net::SSH.start(
62
+ conf['HostName'],
63
+ conf['User'],
64
+ port: conf['Port'],
65
+ password: 'vagrant'
66
+ ) do |ssh|
67
+ ssh_exec!(ssh, 'unset RUBYLIB ; vagrant plugin list')
68
+ end[0].split("\n")).to include(/vagrant-hosts/)
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,62 @@
1
+ require 'spec_helper'
2
+
3
+ class DummyClass
4
+ include ControlSpecHelper
5
+ end
6
+
7
+ describe 'control_spec_helper' do
8
+ before do
9
+ @dummy_class = DummyClass.new
10
+ end
11
+
12
+ describe 'when passed a file path' do
13
+ describe 'if the path does not include manifests' do
14
+ let(:path) { '/test_path/foobar.pp' }
15
+
16
+ it 'should return nil' do
17
+ expect(@dummy_class.class_from_path(path)).to eq(nil)
18
+ end
19
+ end
20
+
21
+ describe 'if the path does not end in pp' do
22
+ let(:path) { '/test_path/manifests/foobar' }
23
+ it 'should return nil' do
24
+ expect(@dummy_class.class_from_path(path)).to eq(nil)
25
+ end
26
+ end
27
+
28
+ context 'when path is simple profile path' do
29
+ let(:path) { '/test_path/site/profiles/manifests/klass.pp' }
30
+ it 'should extrapolate a puppet class name' do
31
+ allow(@dummy_class).to receive(:project_root).and_return('/test_path')
32
+ expect(@dummy_class.class_from_path(path)).to eq('profiles::klass')
33
+ end
34
+ end
35
+
36
+ context 'when path is namespaced profile path' do
37
+ let(:path) { '/test_path/site/profiles/manifests/klass/subklass.pp' }
38
+ it 'should extrapolate a namespaced puppet class name' do
39
+ allow(@dummy_class).to receive(:project_root).and_return('/test_path')
40
+ expect(@dummy_class.class_from_path(path))
41
+ .to eq('profiles::klass::subklass')
42
+ end
43
+ end
44
+
45
+ context 'when path is simple role path' do
46
+ let(:path) { '/test_path/site/role/manifests/klass.pp' }
47
+ it 'should extrapolate a puppet class name' do
48
+ allow(@dummy_class).to receive(:project_root).and_return('/test_path')
49
+ expect(@dummy_class.class_from_path(path)).to eq('role::klass')
50
+ end
51
+ end
52
+
53
+ context 'when path is namespaced role path' do
54
+ let(:path) { '/test_path/site/role/manifests/klass/subklass.pp' }
55
+ it 'should extrapolate a namespaced puppet class name' do
56
+ allow(@dummy_class).to receive(:project_root).and_return('/test_path')
57
+ expect(@dummy_class.class_from_path(path))
58
+ .to eq('role::klass::subklass')
59
+ end
60
+ end
61
+ end
62
+ end
@@ -18,8 +18,69 @@ describe 'control_spec_helper' do
18
18
  expect(@dummy_class.basepath).to eq('dist')
19
19
  end
20
20
 
21
+ it 'should have a default basebranch' do
22
+ expect(@dummy_class.basebranch).to eq('master')
23
+ end
24
+
25
+ it 'should allow you to set basebranch' do
26
+ @dummy_class.basebranch = 'production'
27
+ expect(@dummy_class.basebranch).to eq('production')
28
+ end
29
+
30
+ describe 'when debug environmental variable is set' do
31
+ it 'should print properly-formatted debugging messages' do
32
+ cached_env_debug = ENV['debug']
33
+ ENV['debug'] = 'true'
34
+ expect { @dummy_class.debug('spec') }.to output("DEBUG: spec\n").to_stderr
35
+ ENV['debug'] = cached_env_debug
36
+ end
37
+ end
38
+
39
+ describe 'when debug environmental variable is not set' do
40
+ it 'should suppress debugging messages' do
41
+ cached_env_debug = ENV['debug']
42
+ ENV.delete('debug')
43
+ expect { @dummy_class.debug('spec') }.to_not output('DEBUG: spec')
44
+ .to_stderr
45
+ ENV['debug'] = cached_env_debug
46
+ end
47
+ end
48
+
21
49
  it 'should print the puppet command' do
22
- cmd = "puppet apply manifests/site.pp \\\n --modulepath $(echo `pwd`/modules:`pwd`/site) --hiera_config hiera.yaml"
50
+ cmd = "puppet apply manifests/site.pp \\\n --modulepath " \
51
+ '$(echo `pwd`/modules:`pwd`/site) --hiera_config hiera.yaml'
23
52
  expect(@dummy_class.puppet_cmd).to eq(cmd)
24
53
  end
54
+
55
+ context 'if role_path is already set' do
56
+ it 'should return the predefined role_path' do
57
+ @dummy_class.instance_variable_set(:@role_path, '/role')
58
+ @dummy_class.basepath = 'dist'
59
+ expect(@dummy_class.role_path).to eq('/role')
60
+ end
61
+ end
62
+
63
+ context 'if role_path is not locally set' do
64
+ it 'should return a role_path based on basepath' do
65
+ @dummy_class.instance_variable_set(:@root, '/projroot')
66
+ @dummy_class.basepath = 'dist'
67
+ expect(@dummy_class.role_path).to eq('/projroot/dist/role')
68
+ end
69
+ end
70
+
71
+ context 'if profile_path is already set' do
72
+ it 'should return the predefined profile_path' do
73
+ @dummy_class.instance_variable_set(:@profile_path, '/prof')
74
+ @dummy_class.basepath = 'dist'
75
+ expect(@dummy_class.profile_path).to eq('/prof')
76
+ end
77
+ end
78
+
79
+ context 'if profile_path is not locally set' do
80
+ it 'should return a profile_path based on basepath' do
81
+ @dummy_class.instance_variable_set(:@root, '/projroot')
82
+ @dummy_class.basepath = 'dist'
83
+ expect(@dummy_class.profile_path).to eq('/projroot/dist/profile')
84
+ end
85
+ end
25
86
  end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ class DummyClass
4
+ include ControlSpecHelper
5
+ end
6
+
7
+ describe 'control_spec_helper' do
8
+ before do
9
+ @dummy_class = DummyClass.new
10
+ end
11
+
12
+ describe 'when debug environmental variable is set' do
13
+ it 'should print properly-formatted debugging messages' do
14
+ cached_env_debug = ENV['debug']
15
+ ENV['debug'] = 'true'
16
+ expect { @dummy_class.debug('spec') }.to output("DEBUG: spec\n").to_stderr
17
+ ENV['debug'] = cached_env_debug
18
+ end
19
+ end
20
+
21
+ describe 'when debug environmental variable is not set' do
22
+ it 'should suppress debugging messages' do
23
+ cached_env_debug = ENV['debug']
24
+ ENV.delete('debug')
25
+ expect { @dummy_class.debug('spec') }.to_not output('DEBUG: spec')
26
+ .to_stderr
27
+ ENV['debug'] = cached_env_debug
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ class DummyClass
4
+ include ControlSpecHelper
5
+ end
6
+
7
+ describe 'control_spec_helper' do
8
+ before do
9
+ @dummy_class = DummyClass.new
10
+ end
11
+
12
+ describe 'when diff_from_base is called' do
13
+ git_command = 'git diff production --cached --diff-filter=ACMR --name-only'
14
+
15
+ it 'should call the appropriate git command' do
16
+ @dummy_class.basebranch = 'production'
17
+ expect(@dummy_class).to receive(:`).with(git_command)
18
+ .and_return("a\nb\nc")
19
+ @dummy_class.diff_from_base
20
+ end
21
+
22
+ describe 'result' do
23
+ before do
24
+ @dummy_class.basebranch = 'production'
25
+ allow(@dummy_class).to receive(:`).with(git_command)
26
+ .and_return("a\nb\nc")
27
+ end
28
+
29
+ it 'should return an array' do
30
+ expect(@dummy_class.diff_from_base).to eq(%w(a b c))
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ class DummyClass
4
+ include ControlSpecHelper
5
+ end
6
+
7
+ describe 'control_spec_helper' do
8
+ before do
9
+ @dummy_class = DummyClass.new
10
+ end
11
+
12
+ describe 'when diff_profile is called' do
13
+ it 'should return a diff from base as a map' do
14
+ allow(@dummy_class).to receive(:diff_from_base)
15
+ .and_return([
16
+ 'a',
17
+ '/tmp/foo/site/profile/manifests/foo.pp',
18
+ '/tmp/foo/site/profile/manifests/bar.pp'
19
+ ])
20
+ expect(@dummy_class).to receive(:diff_profile)
21
+ .and_return(['profile::foo', 'profile::bar'])
22
+ @dummy_class.diff_profile
23
+ end
24
+
25
+ it 'should ignore classes in base that are not profiles' do
26
+ allow(@dummy_class).to receive(:diff_from_base)
27
+ .and_return([
28
+ '/tmp/foo/site/profile/manifests/foo.pp',
29
+ '/tmp/foo/site/role/manifests/bar.pp',
30
+ '/tmp/foo/modules/baz/manifests/baz.pp',
31
+ '/tmp/foo/site/profile/manifests/fubar.pp'
32
+ ])
33
+ expect(@dummy_class).to receive(:diff_roles)
34
+ .and_return(['profile::foo', 'profile::fubar'])
35
+ @dummy_class.diff_roles
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ class DummyClass
4
+ include ControlSpecHelper
5
+ end
6
+
7
+ describe 'control_spec_helper' do
8
+ before do
9
+ @dummy_class = DummyClass.new
10
+ end
11
+
12
+ describe 'when diff_roles is called' do
13
+ it 'should return a diff from base as an array' do
14
+ allow(@dummy_class).to receive(:diff_from_base)
15
+ .and_return([
16
+ 'a',
17
+ '/tmp/foo/site/role/manifests/foo.pp',
18
+ '/tmp/foo/site/role/manifests/bar.pp'
19
+ ])
20
+ expect(@dummy_class).to receive(:diff_roles)
21
+ .and_return(['role::foo', 'role::bar'])
22
+ @dummy_class.diff_roles
23
+ end
24
+
25
+ it 'should ignore classes in base that are not roles' do
26
+ allow(@dummy_class).to receive(:diff_from_base)
27
+ .and_return([
28
+ '/tmp/foo/site/profile/manifests/foo.pp',
29
+ '/tmp/foo/site/role/manifests/bar.pp',
30
+ '/tmp/foo/modules/baz/manifests/baz.pp',
31
+ '/tmp/foo/site/role/manifests/fubar.pp'
32
+ ])
33
+ expect(@dummy_class).to receive(:diff_roles)
34
+ .and_return(['role::bar', 'role::fubar'])
35
+ @dummy_class.diff_roles
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,185 @@
1
+ require 'spec_helper'
2
+
3
+ class DummyClass
4
+ include ControlSpecHelper
5
+ end
6
+
7
+ describe 'control_spec_helper' do
8
+ before do
9
+ @dummy_class = DummyClass.new
10
+ end
11
+
12
+ describe 'when profile_fixtures is called' do
13
+ describe 'when debug environmental variable is set' do
14
+ cached_env_debug = ''
15
+
16
+ before(:each) do
17
+ allow(@dummy_class).to receive(:profile_path).and_return('/')
18
+ allow(File).to receive(:symlink)
19
+ .with('/', '/tmp/spec/fixtures/modules/profile')
20
+ end
21
+
22
+ context 'if a profile link already exists' do
23
+ it 'should not try to symlink the profile path' do
24
+ allow(Dir).to receive(:glob).with('/tmp/../../modules/*')
25
+ .and_return([])
26
+ allow(File).to receive(:exists?)
27
+ .with('/tmp/spec/fixtures/modules/profile').and_return(true)
28
+ expect(File).to_not receive(:symlink)
29
+ .with('/', '/tmp/spec/fixtures/modules/profile')
30
+ allow(FileUtils).to receive(:mkpath)
31
+ .with('/tmp/spec/fixtures/modules/')
32
+ expect { @dummy_class.profile_fixtures }
33
+ end
34
+ end
35
+
36
+ context 'if a profile link does not already exist' do
37
+ it 'should symlink the profile path' do
38
+ allow(Dir).to receive(:glob).with('/tmp/../../modules/*')
39
+ .and_return([])
40
+ allow(File).to receive(:exists?)
41
+ .with('/tmp/spec/fixtures/modules/profile').and_return(false)
42
+ allow(@dummy_class).to receive(:file_name).and_return('/tmp/foo.rb')
43
+ expect(File).to receive(:symlink)
44
+ .with('/', '/tmp/spec/fixtures/modules/profile')
45
+ allow(FileUtils).to receive(:mkpath)
46
+ .with('/tmp/spec/fixtures/modules/')
47
+ @dummy_class.profile_fixtures
48
+ end
49
+ end
50
+
51
+ context 'when iterating through available modules' do
52
+ before(:each) do
53
+ allow(Dir).to receive(:glob).with('/tmp/../../modules/*')
54
+ .and_return(%w(foo bar))
55
+ allow(File).to receive(:exists?)
56
+ .with('/tmp/spec/fixtures/modules/profile').and_return(true)
57
+ end
58
+
59
+ context 'if discovered file is not a directory' do
60
+ it 'should not try to perform module operations on that file' do
61
+ allow(File).to receive(:directory?)
62
+ .with('/tmp/spec/fixtures/modules').and_return(true)
63
+ allow(File).to receive(:directory?).with('foo').and_return(false)
64
+ allow(File).to receive(:directory?).with('bar').and_return(false)
65
+ allow(@dummy_class).to receive(:file_name).and_return('/tmp/foo.rb')
66
+ expect(File).to_not receive(:symlink)
67
+ .with('/tmp/foo', '/tmp/spec/fixtures/modules/foo')
68
+ expect(File).to_not receive(:symlink)
69
+ .with('/tmp/bar', '/tmp/spec/fixtures/modules/bar')
70
+ @dummy_class.profile_fixtures
71
+ end
72
+ end
73
+
74
+ context 'if discovered file is a directory' do
75
+ context 'if modules directories already are symlinks' do
76
+ it 'should not try to symlink the module path' do
77
+ allow(File).to receive(:directory?)
78
+ .with('/tmp/spec/fixtures/modules').and_return(true)
79
+ allow(File).to receive(:directory?).with('foo').and_return(true)
80
+ allow(File).to receive(:directory?).with('bar').and_return(true)
81
+ allow(@dummy_class).to receive(:file_name)
82
+ .and_return('/tmp/foo.rb')
83
+ allow(File).to receive(:symlink?)
84
+ .with('/tmp/spec/fixtures/modules/foo').and_return(true)
85
+ allow(File).to receive(:symlink?)
86
+ .with('/tmp/spec/fixtures/modules/bar').and_return(true)
87
+ @dummy_class.profile_fixtures
88
+ end
89
+ end
90
+
91
+ context 'if modules directories do not already have symlinks' do
92
+ it 'should symlink the module path' do
93
+ allow(@dummy_class).to receive(:file_name)
94
+ .and_return('/tmp/control_spec_helper.rb')
95
+ allow(File).to receive(:directory?)
96
+ .with('/tmp/spec/fixtures/modules').and_return(true)
97
+ allow(File).to receive(:directory?)
98
+ .with('foo').and_return(true)
99
+ allow(File).to receive(:directory?)
100
+ .with('bar').and_return(true)
101
+ allow(File).to receive(:symlink?)
102
+ .with('/tmp/spec/fixtures/modules/foo').and_return(false)
103
+ allow(File).to receive(:symlink?)
104
+ .with('/tmp/spec/fixtures/modules/bar').and_return(false)
105
+ expect(File).to receive(:symlink)
106
+ .with('/tmp/foo', '/tmp/spec/fixtures/modules/foo')
107
+ expect(File).to receive(:symlink)
108
+ .with('/tmp/bar', '/tmp/spec/fixtures/modules/bar')
109
+ @dummy_class.profile_fixtures
110
+ end
111
+ end
112
+
113
+ describe 'when debug environmental variable is set' do
114
+ before(:each) do
115
+ allow(@dummy_class).to receive(:profile_path).and_return('/')
116
+ allow(@dummy_class).to receive(:file_name)
117
+ .and_return('/tmp/foo.rb')
118
+ allow(Dir).to receive(:glob).with('/tmp/../../modules/*')
119
+ .and_return([])
120
+ allow(Dir).to receive(:pwd).and_return('/foo')
121
+ allow(File).to receive(:exists?)
122
+ .with('/tmp/spec/fixtures/modules/profile').and_return(true)
123
+ allow(FileUtils).to receive(:mkpath)
124
+ .with('/tmp/spec/fixtures/modules/')
125
+ cached_env_debug = ENV['debug']
126
+ ENV['debug'] = 'true'
127
+ end
128
+
129
+ after(:each) do
130
+ ENV['debug'] = cached_env_debug
131
+ end
132
+
133
+ it 'should print its current profile_path directory' do
134
+ expect { @dummy_class.profile_fixtures }
135
+ .to output(%r{DEBUG: cd to /}).to_stderr
136
+ end
137
+
138
+ it 'should print its actual working directory' do
139
+ expect { @dummy_class.profile_fixtures }
140
+ .to output(%r{DEBUG: cd to /foo}).to_stderr
141
+ end
142
+ end
143
+
144
+ context 'when debug environmental variable is not set' do
145
+ before(:each) do
146
+ allow(@dummy_class).to receive(:profile_path).and_return('/')
147
+ allow(@dummy_class).to receive(:file_name)
148
+ .and_return('/tmp/foo.rb')
149
+ allow(Dir).to receive(:glob).with('/tmp/../../modules/*')
150
+ .and_return([])
151
+ allow(Dir).to receive(:pwd).and_return('/foo')
152
+ allow(File).to receive(:exists?)
153
+ .with('/tmp/spec/fixtures/modules/profile').and_return(true)
154
+ allow(FileUtils).to receive(:mkpath)
155
+ .with('/tmp/spec/fixtures/modules/')
156
+ end
157
+
158
+ it 'should not print its current profile_path directory' do
159
+ cached_env_debug = ENV['debug']
160
+ ENV.delete('debug')
161
+ expect { @dummy_class.profile_fixtures }
162
+ .to_not output(%r{DEBUG: cd to /}).to_stderr
163
+ ENV['debug'] = cached_env_debug
164
+ end
165
+
166
+ it 'should not print its actual working directory' do
167
+ cached_env_debug = ENV['debug']
168
+ ENV.delete('debug')
169
+ expect { @dummy_class.profile_fixtures }
170
+ .to_not output(%r{DEBUG: cd to /foo}).to_stderr
171
+ ENV['debug'] = cached_env_debug
172
+ end
173
+ end
174
+
175
+ it 'should create a modules directory inside fixtures' do
176
+ allow(@dummy_class).to receive(:file_name).and_return('/tmp/foo.rb')
177
+ expect(FileUtils).to receive(:mkpath)
178
+ .with('/tmp/spec/fixtures/modules/')
179
+ @dummy_class.profile_fixtures
180
+ end
181
+ end
182
+ end
183
+ end
184
+ end
185
+ end