Sha256: 644ad6f77635cdf2ddc489678e54ed9eeb3571166b94548c679a0af022c9af8e

Contents?: true

Size: 1.4 KB

Versions: 8

Compression:

Stored size: 1.4 KB

Contents

#
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#


require File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')

describe Ohai::System, "plugin ohai_time" do
  before(:each) do
    @ohai = Ohai::System.new    
    @ohai.stub!(:require_plugin).and_return(true)
  end
  
  it "should get the current time" do
    Time.should_receive(:now)
    @ohai._require_plugin("ohai_time")
  end
  
  it "should turn the time into a floating point number" do
    time = Time.now
    time.should_receive(:to_f)
    Time.stub!(:now).and_return(time)
    @ohai._require_plugin("ohai_time")
  end
  
  it "should set ohai_time to the current time" do
    time = Time.now
    Time.stub!(:now).and_return(time)
    @ohai._require_plugin("ohai_time")
    @ohai[:ohai_time].should == time.to_f    
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
opscode-ohai-0.1.2 spec/ohai/plugins/ohai_time_spec.rb
rightscale-ohai-0.3.3.1 spec/ohai/plugins/ohai_time_spec.rb
rightscale-ohai-0.3.3.2 spec/ohai/plugins/ohai_time_spec.rb
rightscale-ohai-0.3.3.3 spec/ohai/plugins/ohai_time_spec.rb
ohai-0.5.0 spec/ohai/plugins/ohai_time_spec.rb
ohai-0.4.0 spec/ohai/plugins/ohai_time_spec.rb
ohai-0.3.6 spec/ohai/plugins/ohai_time_spec.rb
ohai-0.3.4 spec/ohai/plugins/ohai_time_spec.rb