Sha256: 043534652679f8a9beea8128fb570db87a9a9f0430a1153d0f7e02b018216e5b

Contents?: true

Size: 1.03 KB

Versions: 45

Compression:

Stored size: 1.03 KB

Contents

#!/usr/bin/env rspec

require 'spec_helper'

module MCollective
  describe Facts do
    before do
      class Facts::Testfacts<Facts::Base; end

      PluginManager.delete("facts_plugin")
      PluginManager << {:type => "facts_plugin", :class => "MCollective::Facts::Testfacts"}
    end

    describe "#has_fact?" do
      it "should correctly report fact presense" do
        Facts::Testfacts.any_instance.stubs("load_facts_from_source").returns({"foo" => "bar"})

        Facts.has_fact?("foo", "foo").should == false
        Facts.has_fact?("foo", "bar").should == true
      end
    end

    describe "#get_fact" do
      it "should return the correct fact" do
        Facts::Testfacts.any_instance.stubs("load_facts_from_source").returns({"foo" => "bar"})

        Facts.get_fact("foo").should == "bar"
      end
    end

    describe "#[]" do
      it "should return the correct fact" do
        Facts::Testfacts.any_instance.stubs("load_facts_from_source").returns({"foo" => "bar"})

        Facts["foo"].should == "bar"
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
mcollective-client-2.12.5 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.12.4 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.12.3 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.12.1 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.12.0 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.10.6 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.11.4 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.11.3 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.11.2 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.11.1 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.11.0 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.10.4 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.10.3 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.10.2 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.10.1 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.10.0 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.8.7 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.8.5 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.8.8 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.8.6 spec/unit/mcollective/facts_spec.rb