Sha256: d1398833a6d7466df8969bda77c37792ec3cfef6ed70aa01a4d09855ae10ffbf

Contents?: true

Size: 1.6 KB

Versions: 29

Compression:

Stored size: 1.6 KB

Contents

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

require 'puppet/provider/confine/false'

describe Puppet::Provider::Confine::False do
  it "should be named :false" do
    Puppet::Provider::Confine::False.name.should == :false
  end

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

  describe "when testing values" do
    before { @confine = Puppet::Provider::Confine::False.new("foo") }

    it "should use the 'pass?' method to test validity" do
      @confine = Puppet::Provider::Confine::False.new("foo")
      @confine.label = "eh"
      @confine.expects(:pass?).with("foo")
      @confine.valid?
    end

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

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

    it "should produce a message that a value is true" do
      @confine = Puppet::Provider::Confine::False.new("foo")
      @confine.message("eh").should be_include("true")
    end
  end

  it "should be able to produce a summary with the number of incorrectly true values" do
    confine = Puppet::Provider::Confine::False.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::False.summarize([c1, c2, c3]).should == 6
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
puppet-3.3.2 spec/unit/provider/confine/false_spec.rb
puppet-3.3.1 spec/unit/provider/confine/false_spec.rb
puppet-3.3.1.rc3 spec/unit/provider/confine/false_spec.rb
puppet-3.3.1.rc2 spec/unit/provider/confine/false_spec.rb
puppet-3.3.1.rc1 spec/unit/provider/confine/false_spec.rb
puppet-3.3.0 spec/unit/provider/confine/false_spec.rb
puppet-3.3.0.rc3 spec/unit/provider/confine/false_spec.rb
puppet-3.3.0.rc2 spec/unit/provider/confine/false_spec.rb
puppet-3.2.4 spec/unit/provider/confine/false_spec.rb
puppet-3.2.3 spec/unit/provider/confine/false_spec.rb
puppet-3.2.3.rc1 spec/unit/provider/confine/false_spec.rb
puppet-3.2.2 spec/unit/provider/confine/false_spec.rb
puppet-3.2.1 spec/unit/provider/confine/false_spec.rb
puppet-3.2.1.rc1 spec/unit/provider/confine/false_spec.rb
puppet-3.2.0.rc2 spec/unit/provider/confine/false_spec.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/spec/unit/provider/confine/false_spec.rb
puppet-3.2.0.rc1 spec/unit/provider/confine/false_spec.rb
puppet-3.1.1 spec/unit/provider/confine/false_spec.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/spec/unit/provider/confine/false_spec.rb
puppet-3.1.0 spec/unit/provider/confine/false_spec.rb