chefspec 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,16 +34,16 @@ module ChefSpec
34
34
  Chef::Resource.class_eval do
35
35
  alias :old_run_action :run_action
36
36
 
37
- if self.class.method_defined?(:class_variable_set)
38
- class_variable_set :@@runner, the_runner
37
+ if self.class.methods.include?(:class_variable_set)
38
+ self.class_variable_set :@@runner, the_runner
39
39
  else
40
40
  @@runner = the_runner
41
41
  end
42
42
 
43
43
  def run_action(action)
44
44
  Chef::Log.info("Processing #{self} action #{action} (#{defined_at})") if self.respond_to? :defined_at
45
- if self.class.method_defined?(:class_variable_get)
46
- self.class_variable_get(:@@runner).resources << self
45
+ if self.class.methods.include?(:class_variable_get)
46
+ self.class.class_variable_get(:@@runner).resources << self
47
47
  else
48
48
  @@runner.resources << self
49
49
  end
@@ -107,6 +107,14 @@ module ChefSpec
107
107
  find_resource('file', path)
108
108
  end
109
109
 
110
+ # Find any template declared with the given path
111
+ #
112
+ # @param [String] path The template path
113
+ # @return [Chef::Resource::Directory] The matching template, or Nil
114
+ def template(path)
115
+ find_resource('template', path)
116
+ end
117
+
110
118
  # This runner as a string.
111
119
  #
112
120
  # @return [String] Currently includes the run_list. Format of the string may change between versions of this gem.
@@ -10,10 +10,10 @@ module ChefSpec
10
10
  case resource_type(resource)
11
11
  when 'template'
12
12
  @actual_content = render(resource, chef_run.node)
13
- content == @actual_content
13
+ @actual_content.to_s.include? content
14
14
  when 'file'
15
15
  @actual_content = resource.content
16
- content == @actual_content
16
+ @actual_content.to_s.include? content
17
17
  end
18
18
  end
19
19
  end
@@ -8,7 +8,7 @@ module ChefSpec
8
8
  RSpec::Matchers.define :install_package_at_version do |package_name, version|
9
9
  match do |chef_run|
10
10
  chef_run.resources.any? do |resource|
11
- resource_type(resource) == 'package' and resource.package_name == package_name and resource.action.include? :install and resource.version == version
11
+ resource_type(resource) == 'package' and resource.package_name == package_name and resource.action.to_s.include? 'install' and resource.version == version
12
12
  end
13
13
  end
14
14
  end
@@ -1,4 +1,4 @@
1
1
  module ChefSpec
2
2
  # The gem version
3
- VERSION = '0.3.0'
3
+ VERSION = '0.4.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chefspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-02 00:00:00.000000000Z
12
+ date: 2011-11-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
16
- requirement: &2151873320 !ruby/object:Gem::Requirement
16
+ requirement: &2152367380 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -24,10 +24,10 @@ dependencies:
24
24
  version: '0.10'
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *2151873320
27
+ version_requirements: *2152367380
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: erubis
30
- requirement: &2151885360 !ruby/object:Gem::Requirement
30
+ requirement: &2152365220 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ! '>='
@@ -35,10 +35,10 @@ dependencies:
35
35
  version: '0'
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *2151885360
38
+ version_requirements: *2152365220
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: rspec
41
- requirement: &2151891840 !ruby/object:Gem::Requirement
41
+ requirement: &2152364200 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ! '>='
@@ -46,7 +46,7 @@ dependencies:
46
46
  version: 2.6.0
47
47
  type: :runtime
48
48
  prerelease: false
49
- version_requirements: *2151891840
49
+ version_requirements: *2152364200
50
50
  description: Write RSpec examples for Opscode Chef recipes
51
51
  email:
52
52
  executables: []
@@ -81,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  segments:
83
83
  - 0
84
- hash: 4357686734109657142
84
+ hash: 1029718533477551194
85
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
@@ -90,11 +90,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  segments:
92
92
  - 0
93
- hash: 4357686734109657142
93
+ hash: 1029718533477551194
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 1.8.6
96
+ rubygems_version: 1.8.10
97
97
  signing_key:
98
98
  specification_version: 3
99
- summary: chefspec-0.3.0
99
+ summary: chefspec-0.4.0
100
100
  test_files: []