Skip to content

Commit

Permalink
Set automatic attribute "languages"
Browse files Browse the repository at this point in the history
- Some cookbooks, notably opscode's passenger_apache2, expect the "languages" mash to exist. These cookbooks cause
  other cookbooks to fail during chefspec tests since the languages mash is referenced in attributes.
  • Loading branch information
jimhopp-lookout committed Apr 24, 2012
1 parent 8808b77 commit 55819e3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/chefspec/chef_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def to_s
# @param [Ohai::System] ohai The ohai instance to set fake attributes on
def fake_ohai(ohai)
{:os => 'chefspec', :os_version => ChefSpec::VERSION, :fqdn => 'chefspec.local', :domain => 'local',
:ipaddress => '127.0.0.1', :hostname => 'chefspec',
:ipaddress => '127.0.0.1', :hostname => 'chefspec', :languages => Mash.new({"ruby" => "/usr/somewhere"}),
:kernel => Mash.new({:machine => 'i386'})}.each_pair do |attribute,value|
ohai[attribute] = value
end
Expand Down
3 changes: 2 additions & 1 deletion spec/chefspec/chef_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ module ChefSpec
context "default ohai attributes" do
let(:node){ChefSpec::ChefRunner.new.node}
specify{node.os.should == 'chefspec'}
specify{node.languages['ruby'].should == "/usr/somewhere"}
specify{node.os_version.should == ChefSpec::VERSION}
specify{node.fqdn.should == 'chefspec.local'}
specify{node.domain.should == 'local'}
Expand Down Expand Up @@ -140,4 +141,4 @@ module ChefSpec
end
end
end
end
end

0 comments on commit 55819e3

Please sign in to comment.