minitest-chef-handler 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 0.6.7 / 02-07-2013
2
+
3
+ * 1 bug fix:
4
+
5
+ * Support auto-discovery of test paths under chef version 11.
6
+
1
7
  === 0.6.6 / 02-07-2013
2
8
 
3
9
  * 1 bug fix:
@@ -39,7 +39,7 @@ module MiniTest
39
39
  # cookbooks/foo/specs/install/*_spec.rb
40
40
  #
41
41
  def seen_recipes_paths
42
- run_status.node.run_state[:seen_recipes].keys.map do |recipe_name|
42
+ used_recipe_names.map do |recipe_name|
43
43
  cookbook_name, recipe_short_name = ::Chef::Recipe.parse_recipe_name(recipe_name)
44
44
  base_path = ::Chef::Config[:cookbook_path]
45
45
 
@@ -56,6 +56,14 @@ module MiniTest
56
56
  end.flatten
57
57
  end
58
58
 
59
+ def used_recipe_names
60
+ if recipes = run_status.node.run_state[:seen_recipes]
61
+ recipes.keys
62
+ else
63
+ run_status.node.run_list.select(&:recipe?).map(&:name)
64
+ end
65
+ end
66
+
59
67
  # Internal - look for the right path to the cookbook given one or
60
68
  # several base paths.
61
69
  #
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
12
12
  gem.name = "minitest-chef-handler"
13
13
  gem.require_paths = ["lib"]
14
- gem.version = '0.6.6'
14
+ gem.version = '0.6.7'
15
15
 
16
16
  gem.add_dependency('minitest')
17
17
  gem.add_dependency('chef')
@@ -1,4 +1,5 @@
1
1
  require File.expand_path('../../spec_helper', __FILE__)
2
+ require "chef/run_list/run_list_item"
2
3
 
3
4
  describe MiniTest::Chef::Lookup do
4
5
  include MiniTest::Chef::Lookup
@@ -18,4 +19,20 @@ describe MiniTest::Chef::Lookup do
18
19
  require_test_suites(["lib/*"])
19
20
  end
20
21
  end
22
+
23
+ describe "#used_recipe_names" do
24
+ before do
25
+ stubs(:run_status => stub(:node => stub(:run_state => {})))
26
+ end
27
+
28
+ it "uses seen_recipes if run_state is not empty" do
29
+ run_status.node.run_state[:seen_recipes] = {"some" => 1, "other" => 2}
30
+ used_recipe_names.must_equal ["some", "other"]
31
+ end
32
+
33
+ it "uses run_list if run_state is empty" do
34
+ run_status.node.stubs(:run_list => %w(recipe[foo] recipe[bar] role[someone]).map { |i| Chef::RunList::RunListItem.new(i) })
35
+ used_recipe_names.must_equal ["foo", "bar"]
36
+ end
37
+ end
21
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-chef-handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-07 00:00:00.000000000 Z
12
+ date: 2013-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -159,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  segments:
161
161
  - 0
162
- hash: -302920320166944081
162
+ hash: -558242354881873270
163
163
  required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  none: false
165
165
  requirements:
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  segments:
170
170
  - 0
171
- hash: -302920320166944081
171
+ hash: -558242354881873270
172
172
  requirements: []
173
173
  rubyforge_project:
174
174
  rubygems_version: 1.8.23