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.9.1 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.9.0 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.8.9 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.8.4 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.8.3 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.8.2 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.8.1 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.8.0 spec/unit/mcollective/facts_spec.rb
mcollective-client-2.7.0 spec/unit/facts_spec.rb
mcollective-client-2.6.1 spec/unit/facts_spec.rb
mcollective-client-2.6.0 spec/unit/facts_spec.rb
mcollective-client-2.5.3 spec/unit/facts_spec.rb
mcollective-client-2.5.2 spec/unit/facts_spec.rb
mcollective-client-2.5.1 spec/unit/facts_spec.rb
mcollective-client-2.5.0 spec/unit/facts_spec.rb
mcollective-client-2.5.0.rc1 spec/unit/facts_spec.rb
mcollective-client-2.4.1 spec/unit/facts_spec.rb
mcollective-client-2.4.0 spec/unit/facts_spec.rb
mcollective-client-2.2.4 spec/unit/facts_spec.rb
mcollective-client-2.2.3 spec/unit/facts_spec.rb