Sha256: 14f05793b85751efe2f6ee62dfc7037fd15a86a5ca746096b56a7d3210d72fa6

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

begin
  require 'spec'
rescue LoadError
  require 'rubygems'
  gem 'rspec'
  require 'spec'
end

$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'ohai'
Ohai::Config[:log_level] = :error

def it_should_check_from(plugin, attribute, from, value)
  it "should get the #{attribute} value from '#{from}'" do
    @ohai.should_receive(:from).with(from).and_return(value)
    @ohai._require_plugin(plugin)
  end
  
  it "should set the #{attribute} to the value from '#{from}'" do
    @ohai._require_plugin(plugin)
    @ohai[attribute].should == value
  end
end

def it_should_check_from_mash(plugin, attribute, from, value)
  it "should get the #{plugin}[:#{attribute}] value from '#{from}'" do
    @ohai.should_receive(:from).with(from).and_return(value)
    @ohai._require_plugin(plugin)
  end
  
  it "should set the #{plugin}[:#{attribute}] to the value from '#{from}'" do
    @ohai._require_plugin(plugin)
    @ohai[plugin][attribute].should == value
  end
end

def it_should_check_from_deep_mash(plugin, mash, attribute, from, value)
  it "should get the #{mash}[:#{attribute}] value from '#{from}'" do
    @ohai.should_receive(:from).with(from).and_return(value)
    @ohai._require_plugin(plugin)
  end
  
  it "should set the #{mash}[:#{attribute}] to the value from '#{from}'" do
    @ohai._require_plugin(plugin)
    @ohai[mash][attribute].should == value
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opscode-ohai-0.1.2 spec/spec_helper.rb