Sha256: d946c6303179208cccd26e5f8a83b3799ecfc911eee9f2cfd0829f338688fa32

Contents?: true

Size: 1.48 KB

Versions: 35

Compression:

Stored size: 1.48 KB

Contents

#!/usr/bin/env rspec
require 'spec_helper'

require 'puppet/provider/confine/true'

describe Puppet::Provider::Confine::True do
  it "should be named :true" do
    Puppet::Provider::Confine::True.name.should == :true
  end

  it "should require a value" do
    lambda { Puppet::Provider::Confine::True.new }.should raise_error(ArgumentError)
  end

  describe "when testing values" do
    before do
      @confine = Puppet::Provider::Confine::True.new("foo")
      @confine.label = "eh"
    end

    it "should use the 'pass?' method to test validity" do
      @confine.expects(:pass?).with("foo")
      @confine.valid?
    end

    it "should return true if the value is not false" do
      @confine.pass?("else").should be_true
    end

    it "should return false if the value is false" do
      @confine.pass?(nil).should be_false
    end

    it "should produce the message that a value is false" do
      @confine.message("eh").should be_include("false")
    end
  end

  it "should produce the number of false values when asked for a summary" do
    @confine = Puppet::Provider::Confine::True.new %w{one two three four}
    @confine.expects(:pass?).times(4).returns(true).returns(false).returns(true).returns(false)
    @confine.summary.should == 2
  end

  it "should summarize multiple instances by summing their summaries" do
    c1 = mock '1', :summary => 1
    c2 = mock '2', :summary => 2
    c3 = mock '3', :summary => 3

    Puppet::Provider::Confine::True.summarize([c1, c2, c3]).should == 6
  end
end

Version data entries

35 entries across 35 versions & 3 rubygems

Version Path
puppet-2.7.26 spec/unit/provider/confine/true_spec.rb
puppet-2.7.25 spec/unit/provider/confine/true_spec.rb
puppet-2.7.24 spec/unit/provider/confine/true_spec.rb
puppet-2.7.23 spec/unit/provider/confine/true_spec.rb
puppet-2.7.22 spec/unit/provider/confine/true_spec.rb
puppet-2.7.21 spec/unit/provider/confine/true_spec.rb
puppet-2.7.20 spec/unit/provider/confine/true_spec.rb
puppet-2.7.20.rc1 spec/unit/provider/confine/true_spec.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/unit/provider/confine/true_spec.rb
puppet-2.7.19 spec/unit/provider/confine/true_spec.rb
supply_drop-0.11.0 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/provider/confine/true_spec.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/unit/provider/confine/true_spec.rb
supply_drop-0.10.2 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/provider/confine/true_spec.rb
puppet-2.7.18 spec/unit/provider/confine/true_spec.rb
supply_drop-0.10.1 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/provider/confine/true_spec.rb
supply_drop-0.10.0 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/provider/confine/true_spec.rb
puppet-2.7.17 spec/unit/provider/confine/true_spec.rb
puppet-2.7.16 spec/unit/provider/confine/true_spec.rb
puppet-2.7.14 spec/unit/provider/confine/true_spec.rb
puppet-2.7.13 spec/unit/provider/confine/true_spec.rb