librarian 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. data/CHANGELOG.md +4 -0
  2. data/lib/librarian.rb +5 -178
  3. data/lib/librarian/action.rb +5 -0
  4. data/lib/librarian/action/base.rb +22 -0
  5. data/lib/librarian/action/clean.rb +56 -0
  6. data/lib/librarian/action/ensure.rb +24 -0
  7. data/lib/librarian/action/install.rb +101 -0
  8. data/lib/librarian/action/resolve.rb +81 -0
  9. data/lib/librarian/action/update.rb +76 -0
  10. data/lib/librarian/chef/cli.rb +7 -2
  11. data/lib/librarian/chef/dsl.rb +0 -3
  12. data/lib/librarian/chef/environment.rb +19 -0
  13. data/lib/librarian/chef/extension.rb +1 -16
  14. data/lib/librarian/chef/integration/knife.rb +9 -16
  15. data/lib/librarian/chef/source/git.rb +0 -2
  16. data/lib/librarian/chef/source/local.rb +1 -74
  17. data/lib/librarian/chef/source/local/manifest.rb +82 -0
  18. data/lib/librarian/chef/source/path.rb +0 -2
  19. data/lib/librarian/chef/source/site.rb +9 -89
  20. data/lib/librarian/chef/source/site/manifest.rb +94 -0
  21. data/lib/librarian/cli.rb +56 -17
  22. data/lib/librarian/dependency.rb +2 -2
  23. data/lib/librarian/dsl.rb +15 -5
  24. data/lib/librarian/dsl/receiver.rb +2 -0
  25. data/lib/librarian/dsl/target.rb +13 -1
  26. data/lib/librarian/environment.rb +94 -0
  27. data/lib/librarian/error.rb +4 -0
  28. data/lib/librarian/helpers/debug.rb +6 -6
  29. data/lib/librarian/lockfile.rb +7 -5
  30. data/lib/librarian/lockfile/compiler.rb +5 -4
  31. data/lib/librarian/lockfile/parser.rb +6 -5
  32. data/lib/librarian/manifest.rb +2 -2
  33. data/lib/librarian/mock/cli.rb +6 -1
  34. data/lib/librarian/mock/dsl.rb +0 -3
  35. data/lib/librarian/mock/environment.rb +24 -0
  36. data/lib/librarian/mock/extension.rb +1 -20
  37. data/lib/librarian/mock/source/mock.rb +7 -7
  38. data/lib/librarian/mock/source/mock/registry.rb +16 -12
  39. data/lib/librarian/resolver.rb +5 -116
  40. data/lib/librarian/resolver/implementation.rb +117 -0
  41. data/lib/librarian/source/git.rb +8 -7
  42. data/lib/librarian/source/git/repository.rb +7 -5
  43. data/lib/librarian/source/local.rb +1 -1
  44. data/lib/librarian/source/path.rb +7 -6
  45. data/lib/librarian/spec_change_set.rb +6 -5
  46. data/lib/librarian/specfile.rb +10 -4
  47. data/lib/librarian/version.rb +1 -1
  48. data/librarian.gemspec +1 -0
  49. data/spec/functional/chef/source/git_spec.rb +177 -89
  50. data/spec/functional/chef/source/site_spec.rb +111 -52
  51. data/spec/unit/action/base_spec.rb +18 -0
  52. data/spec/unit/action/clean_spec.rb +133 -0
  53. data/spec/unit/action/ensure_spec.rb +37 -0
  54. data/spec/unit/action/install_spec.rb +113 -0
  55. data/spec/unit/dsl_spec.rb +15 -13
  56. data/spec/unit/environment_spec.rb +9 -0
  57. data/spec/unit/lockfile_spec.rb +15 -4
  58. data/spec/unit/mock/source/mock.rb +22 -0
  59. data/spec/unit/resolver_spec.rb +24 -24
  60. data/spec/unit/spec_change_set_spec.rb +29 -25
  61. metadata +47 -19
  62. data/lib/librarian/chef/particularity.rb +0 -9
  63. data/lib/librarian/mock/particularity.rb +0 -9
  64. data/lib/librarian/particularity.rb +0 -7
@@ -2,7 +2,6 @@ require 'fileutils'
2
2
  require 'pathname'
3
3
  require 'digest'
4
4
 
5
- require 'librarian/particularity'
6
5
  require 'librarian/source/git/repository'
7
6
  require 'librarian/source/local'
8
7
 
@@ -10,7 +9,6 @@ module Librarian
10
9
  module Source
11
10
  class Git
12
11
 
13
- include Particularity
14
12
  include Local
15
13
 
16
14
  class << self
@@ -18,8 +16,8 @@ module Librarian
18
16
  def lock_name
19
17
  LOCK_NAME
20
18
  end
21
- def from_lock_options(options)
22
- new(options[:remote], options.reject{|k, v| k == :remote})
19
+ def from_lock_options(environment, options)
20
+ new(environment, options[:remote], options.reject{|k, v| k == :remote})
23
21
  end
24
22
  end
25
23
 
@@ -27,9 +25,12 @@ module Librarian
27
25
  :ref => 'master'
28
26
  }
29
27
 
28
+ attr_accessor :environment
29
+ private :environment=
30
30
  attr_reader :uri, :ref, :sha, :path
31
31
 
32
- def initialize(uri, options = {})
32
+ def initialize(environment, uri, options = {})
33
+ self.environment = environment
33
34
  @uri = uri
34
35
  @ref = options[:ref] || DEFAULTS[:ref]
35
36
  @sha = options[:sha]
@@ -80,13 +81,13 @@ module Librarian
80
81
  @repository_cache_path ||= begin
81
82
  dir = path ? "#{uri}/#{path}" : uri
82
83
  dir = Digest::MD5.hexdigest(dir)
83
- root_module.cache_path.join("source/git/#{dir}")
84
+ environment.cache_path.join("source/git/#{dir}")
84
85
  end
85
86
  end
86
87
 
87
88
  def repository
88
89
  @repository ||= begin
89
- Repository.new(root_module, repository_cache_path)
90
+ Repository.new(environment, repository_cache_path)
90
91
  end
91
92
  end
92
93
 
@@ -8,10 +8,10 @@ module Librarian
8
8
  class Repository
9
9
 
10
10
  class << self
11
- def clone!(root_module, path, repository_url)
11
+ def clone!(environment, path, repository_url)
12
12
  path = Pathname.new(path)
13
13
  path.mkpath
14
- git = new(root_module, path)
14
+ git = new(environment, path)
15
15
  git.clone!(repository_url)
16
16
  git
17
17
  end
@@ -19,11 +19,13 @@ module Librarian
19
19
 
20
20
  include Helpers::Debug
21
21
 
22
- attr_reader :root_module, :path
22
+ attr_accessor :environment
23
+ private :environment=
24
+ attr_reader :path
23
25
 
24
- def initialize(root_module, path)
26
+ def initialize(environment, path)
27
+ self.environment = environment
25
28
  path = Pathname.new(path)
26
- @root_module = root_module
27
29
  @path = path
28
30
  end
29
31
 
@@ -4,7 +4,7 @@ module Librarian
4
4
  module Source
5
5
  # Requires that the including source class have methods:
6
6
  # #path
7
- # #root_module
7
+ # #environment
8
8
  module Local
9
9
 
10
10
  include Support::AbstractMethod
@@ -1,11 +1,9 @@
1
- require 'librarian/particularity'
2
1
  require 'librarian/source/local'
3
2
 
4
3
  module Librarian
5
4
  module Source
6
5
  class Path
7
6
 
8
- include Particularity
9
7
  include Local
10
8
 
11
9
  class << self
@@ -13,14 +11,17 @@ module Librarian
13
11
  def lock_name
14
12
  LOCK_NAME
15
13
  end
16
- def from_lock_options(options)
17
- new(options[:remote], options.reject{|k, v| k == :remote})
14
+ def from_lock_options(environment, options)
15
+ new(environment, options[:remote], options.reject{|k, v| k == :remote})
18
16
  end
19
17
  end
20
18
 
19
+ attr_accessor :environment
20
+ private :environment=
21
21
  attr_reader :path
22
22
 
23
- def initialize(path, options)
23
+ def initialize(environment, path, options)
24
+ self.environment = environment
24
25
  @path = path
25
26
  end
26
27
 
@@ -46,7 +47,7 @@ module Librarian
46
47
  end
47
48
 
48
49
  def filesystem_path
49
- @filesystem_path ||= Pathname.new(path).expand_path(root_module.project_path)
50
+ @filesystem_path ||= Pathname.new(path).expand_path(environment.project_path)
50
51
  end
51
52
 
52
53
  end
@@ -10,13 +10,14 @@ module Librarian
10
10
 
11
11
  include Helpers::Debug
12
12
 
13
- attr_reader :root_module
13
+ attr_accessor :environment
14
+ private :environment=
14
15
  attr_reader :spec, :lock
15
16
 
16
- def initialize(root_module, spec, lock)
17
- @root_module = root_module
18
- raise TypeError, "can't convert #{spec.class} into Spec" unless Spec === spec
19
- raise TypeError, "can't convert #{lock.class} into Resolution" unless Resolution === lock
17
+ def initialize(environment, spec, lock)
18
+ self.environment = environment
19
+ raise TypeError, "can't convert #{spec.class} into #{Spec}" unless Spec === spec
20
+ raise TypeError, "can't convert #{lock.class} into #{Resolution}" unless Resolution === lock
20
21
  @spec, @lock = spec, lock
21
22
  end
22
23
 
@@ -1,15 +1,21 @@
1
+ require 'librarian/helpers/debug'
2
+
1
3
  module Librarian
2
4
  class Specfile
3
5
 
4
- attr_reader :root_module, :path, :dependencies, :source
6
+ include Helpers::Debug
7
+
8
+ attr_accessor :environment
9
+ private :environment=
10
+ attr_reader :path, :dependencies, :source
5
11
 
6
- def initialize(root_module, path)
7
- @root_module = root_module
12
+ def initialize(environment, path)
13
+ self.environment = environment
8
14
  @path = path
9
15
  end
10
16
 
11
17
  def read(precache_sources = [])
12
- root_module.dsl_class.run(self, precache_sources)
18
+ environment.dsl_class.run(environment, path.read, precache_sources)
13
19
  end
14
20
 
15
21
  end
@@ -1,3 +1,3 @@
1
1
  module Librarian
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
data/librarian.gemspec CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.add_dependency "thor"
23
23
 
24
+ s.add_development_dependency "rake"
24
25
  s.add_development_dependency "rspec"
25
26
  s.add_development_dependency "cucumber"
26
27
  s.add_development_dependency "aruba"
@@ -3,6 +3,9 @@ require 'securerandom'
3
3
 
4
4
  require 'librarian'
5
5
  require 'librarian/helpers'
6
+ require 'librarian/error'
7
+ require 'librarian/action/resolve'
8
+ require 'librarian/action/install'
6
9
  require 'librarian/chef'
7
10
 
8
11
  module Librarian
@@ -19,6 +22,9 @@ module Librarian
19
22
 
20
23
  let(:cookbooks_path) { tmp_path.join("cookbooks") }
21
24
 
25
+ # depends on repo_path being defined in each context
26
+ let(:env) { Environment.new(:project_path => repo_path) }
27
+
22
28
  context "a single dependency with a git source" do
23
29
 
24
30
  let(:sample_path) { tmp_path.join("sample") }
@@ -65,82 +71,137 @@ module Librarian
65
71
  end
66
72
  end
67
73
 
68
- it "should resolve" do
69
- repo_path = tmp_path.join("repo/resolve")
70
- repo_path.rmtree if repo_path.exist?
71
- repo_path.mkpath
72
- repo_path.join("cookbooks").mkpath
73
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
74
- #!/usr/bin/env ruby
75
- cookbook "sample", :git => #{sample_path.to_s.inspect}
76
- CHEFFILE
77
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
78
- Chef.stub!(:project_path) { repo_path }
74
+ context "resolving" do
75
+ let(:repo_path) { tmp_path.join("repo/resolve") }
76
+ before do
77
+ repo_path.rmtree if repo_path.exist?
78
+ repo_path.mkpath
79
+ repo_path.join("cookbooks").mkpath
80
+ cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
81
+ #!/usr/bin/env ruby
82
+ cookbook "sample", :git => #{sample_path.to_s.inspect}
83
+ CHEFFILE
84
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
85
+ end
86
+
87
+ context "the resolve" do
88
+ it "should not raise an exception" do
89
+ expect { Action::Resolve.new(env).run }.to_not raise_error
90
+ end
91
+ end
92
+
93
+ context "the results" do
94
+ before { Action::Resolve.new(env).run }
79
95
 
80
- Chef.resolve!
81
- repo_path.join("Cheffile.lock").should exist
82
- repo_path.join("cookbooks/sample").should_not exist
96
+ it "should create the lockfile" do
97
+ repo_path.join("Cheffile.lock").should exist
98
+ end
99
+
100
+ it "should not attempt to install the sample cookbok" do
101
+ repo_path.join("cookbooks/sample").should_not exist
102
+ end
103
+ end
83
104
  end
84
105
 
85
- it "should install" do
86
- repo_path = tmp_path.join("repo/install")
87
- repo_path.rmtree if repo_path.exist?
88
- repo_path.mkpath
89
- repo_path.join("cookbooks").mkpath
90
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
91
- #!/usr/bin/env ruby
92
- cookbook "sample", :git => #{sample_path.to_s.inspect}
93
- CHEFFILE
94
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
95
- Chef.stub!(:project_path) { repo_path }
106
+ context "installing" do
107
+ let(:repo_path) { tmp_path.join("repo/install") }
108
+ before do
109
+ repo_path.rmtree if repo_path.exist?
110
+ repo_path.mkpath
111
+ repo_path.join("cookbooks").mkpath
112
+ cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
113
+ #!/usr/bin/env ruby
114
+ cookbook "sample", :git => #{sample_path.to_s.inspect}
115
+ CHEFFILE
116
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
117
+
118
+ Action::Resolve.new(env).run
119
+ end
120
+
121
+ context "the install" do
122
+ it "should not raise an exception" do
123
+ expect { Action::Install.new(env).run }.to_not raise_error
124
+ end
125
+ end
126
+
127
+ context "the results" do
128
+ before { Action::Install.new(env).run }
96
129
 
97
- Chef.install!
98
- repo_path.join("Cheffile.lock").should exist
99
- repo_path.join("cookbooks/sample").should exist
100
- repo_path.join("cookbooks/sample/metadata.rb").should exist
130
+ it "should create the lockfile" do
131
+ repo_path.join("Cheffile.lock").should exist
132
+ end
133
+
134
+ it "should create the directory for the cookbook" do
135
+ repo_path.join("cookbooks/sample").should exist
136
+ end
137
+
138
+ it "should copy the cookbook files into the cookbook directory" do
139
+ repo_path.join("cookbooks/sample/metadata.rb").should exist
140
+ end
141
+ end
101
142
  end
102
143
 
103
- it "should resolve and separately install" do
104
- repo_path = tmp_path.join("repo/resolve-install")
105
- repo_path.rmtree if repo_path.exist?
106
- repo_path.mkpath
107
- repo_path.join("cookbooks").mkpath
108
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
109
- #!/usr/bin/env ruby
110
- cookbook "sample", :git => #{sample_path.to_s.inspect}
111
- CHEFFILE
112
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
113
- Chef.stub!(:project_path) { repo_path }
144
+ context "resolving and and separately installing" do
145
+ let(:repo_path) { tmp_path.join("repo/resolve-install") }
146
+ before do
147
+ repo_path.rmtree if repo_path.exist?
148
+ repo_path.mkpath
149
+ repo_path.join("cookbooks").mkpath
150
+ cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
151
+ #!/usr/bin/env ruby
152
+ cookbook "sample", :git => #{sample_path.to_s.inspect}
153
+ CHEFFILE
154
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
114
155
 
115
- Chef.resolve!
116
- repo_path.join("tmp").rmtree if repo_path.join("tmp").exist?
117
- Chef.install!
118
- repo_path.join("cookbooks/sample").should exist
119
- repo_path.join("cookbooks/sample/metadata.rb").should exist
156
+ Action::Resolve.new(env).run
157
+ repo_path.join("tmp").rmtree if repo_path.join("tmp").exist?
158
+ end
159
+
160
+ context "the install" do
161
+ it "should not raise an exception" do
162
+ expect { Action::Install.new(env).run }.to_not raise_error
163
+ end
164
+ end
165
+
166
+ context "the results" do
167
+ before { Action::Install.new(env).run }
168
+
169
+ it "should create the directory for the cookbook" do
170
+ repo_path.join("cookbooks/sample").should exist
171
+ end
172
+
173
+ it "should copy the cookbook files into the cookbook directory" do
174
+ repo_path.join("cookbooks/sample/metadata.rb").should exist
175
+ end
176
+ end
120
177
  end
121
178
 
122
- it "should resolve, change, and resolve" do
123
- repo_path = tmp_path.join("repo/resolve-update")
124
- repo_path.rmtree if repo_path.exist?
125
- repo_path.mkpath
126
- repo_path.join("cookbooks").mkpath
127
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
128
- git #{cookbooks_path.to_s.inspect}
129
- cookbook "first-sample"
130
- CHEFFILE
131
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
132
- Chef.stub!(:project_path) { repo_path }
133
- Chef.resolve!
134
- repo_path.join("Cheffile.lock").should exist
179
+ context "resolving, changing, and resolving" do
180
+ let(:repo_path) { tmp_path.join("repo/resolve-update") }
181
+ before do
182
+ repo_path.rmtree if repo_path.exist?
183
+ repo_path.mkpath
184
+ repo_path.join("cookbooks").mkpath
185
+ cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
186
+ git #{cookbooks_path.to_s.inspect}
187
+ cookbook "first-sample"
188
+ CHEFFILE
189
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
190
+ Action::Resolve.new(env).run
135
191
 
136
- cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
137
- git #{cookbooks_path.to_s.inspect}
138
- cookbook "first-sample"
139
- cookbook "second-sample"
140
- CHEFFILE
141
- repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
142
- Chef.stub!(:project_path) { repo_path }
143
- Chef.resolve!
192
+ cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
193
+ git #{cookbooks_path.to_s.inspect}
194
+ cookbook "first-sample"
195
+ cookbook "second-sample"
196
+ CHEFFILE
197
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
198
+ end
199
+
200
+ context "the second resolve" do
201
+ it "should not raise an exception" do
202
+ expect { Action::Resolve.new(env).run }.to_not raise_error
203
+ end
204
+ end
144
205
  end
145
206
 
146
207
  end
@@ -168,8 +229,8 @@ module Librarian
168
229
  end
169
230
 
170
231
  context "if no path option is given" do
171
- it "should not resolve" do
172
- repo_path = tmp_path.join("repo/resolve")
232
+ let(:repo_path) { tmp_path.join("repo/resolve") }
233
+ before do
173
234
  repo_path.rmtree if repo_path.exist?
174
235
  repo_path.mkpath
175
236
  repo_path.join("cookbooks").mkpath
@@ -179,15 +240,16 @@ module Librarian
179
240
  :git => #{git_path.to_s.inspect}
180
241
  CHEFFILE
181
242
  repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
182
- Chef.stub!(:project_path) { repo_path }
243
+ end
183
244
 
184
- expect{ Chef.resolve! }.to raise_error
245
+ it "should not resolve" do
246
+ expect{ Action::Resolve.new(env).run }.to raise_error
185
247
  end
186
248
  end
187
249
 
188
250
  context "if the path option is wrong" do
189
- it "should not resolve" do
190
- repo_path = tmp_path.join("repo/resolve")
251
+ let(:repo_path) { tmp_path.join("repo/resolve") }
252
+ before do
191
253
  repo_path.rmtree if repo_path.exist?
192
254
  repo_path.mkpath
193
255
  repo_path.join("cookbooks").mkpath
@@ -198,18 +260,19 @@ module Librarian
198
260
  :path => "jelly"
199
261
  CHEFFILE
200
262
  repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
201
- Chef.stub!(:project_path) { repo_path }
263
+ end
202
264
 
203
- expect{ Chef.resolve! }.to raise_error
265
+ it "should not resolve" do
266
+ expect{ Action::Resolve.new(env).run }.to raise_error
204
267
  end
205
268
  end
206
269
 
207
270
  context "if the path option is right" do
208
- it "should not resolve" do
209
- repo_path = tmp_path.join('repo/resolve')
271
+ let(:repo_path) { tmp_path.join("repo/resolve") }
272
+ before do
210
273
  repo_path.rmtree if repo_path.exist?
211
274
  repo_path.mkpath
212
- repo_path.join('cookbooks').mkpath
275
+ repo_path.join("cookbooks").mkpath
213
276
  cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
214
277
  #!/usr/bin/env ruby
215
278
  cookbook "sample",
@@ -217,11 +280,20 @@ module Librarian
217
280
  :path => "buttercup"
218
281
  CHEFFILE
219
282
  repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
220
- Chef.stub!(:project_path) { repo_path }
283
+ end
221
284
 
222
- Chef.resolve!
223
- repo_path.join("Cheffile.lock").should exist
224
- repo_path.join("cookbooks/sample").should_not exist
285
+ context "the resolve" do
286
+ it "should not raise an exception" do
287
+ expect { Action::Resolve.new(env).run }.to_not raise_error
288
+ end
289
+ end
290
+
291
+ context "the results" do
292
+ before { Action::Resolve.new(env).run }
293
+
294
+ it "should create the lockfile" do
295
+ repo_path.join("Cheffile.lock").should exist
296
+ end
225
297
  end
226
298
  end
227
299
 
@@ -229,9 +301,8 @@ module Librarian
229
301
 
230
302
  context "missing a metadata" do
231
303
  let(:git_path) { tmp_path.join("big-git-repo") }
232
-
233
- it "should explain the problem" do
234
- repo_path = tmp_path.join("repo/resolve")
304
+ let(:repo_path) { tmp_path.join("repo/resolve") }
305
+ before do
235
306
  repo_path.rmtree if repo_path.exist?
236
307
  repo_path.mkpath
237
308
  repo_path.join("cookbooks").mkpath
@@ -240,12 +311,29 @@ module Librarian
240
311
  :git => #{git_path.to_s.inspect}
241
312
  CHEFFILE
242
313
  repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
243
- Chef.stub!(:project_path) { repo_path }
314
+ end
244
315
 
245
- expect { Chef.resolve! }.
246
- to raise_error(Librarian::Error, /no metadata file found/i)
247
- repo_path.join("Cheffile.lock").should_not exist
248
- repo_path.join("cookbooks/sample").should_not exist
316
+ context "the resolve" do
317
+ it "should raise an exception" do
318
+ expect { Action::Resolve.new(env).run }.to raise_error
319
+ end
320
+
321
+ it "should explain the problem" do
322
+ expect { Action::Resolve.new(env).run }.
323
+ to raise_error(Error, /no metadata file found/i)
324
+ end
325
+ end
326
+
327
+ context "the results" do
328
+ before { Action::Resolve.new(env).run rescue nil }
329
+
330
+ it "should not create the lockfile" do
331
+ repo_path.join("Cheffile.lock").should_not exist
332
+ end
333
+
334
+ it "should not create the directory for the cookbook" do
335
+ repo_path.join("cookbooks/sample").should_not exist
336
+ end
249
337
  end
250
338
  end
251
339