Sha256: 78efa11abc13a19050bd941cb77d84b79b53ce1e5c666dfb36888b431ab7fb1d

Contents?: true

Size: 1.51 KB

Versions: 63

Compression:

Stored size: 1.51 KB

Contents

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

require 'puppet/confine/false'

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

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

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

    it "should use the 'pass?' method to test validity" do
      @confine = Puppet::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::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::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::Confine::False.summarize([c1, c2, c3]).should == 6
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/unit/confine/false_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/confine/false_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/confine/false_spec.rb
puppet-3.8.6 spec/unit/confine/false_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/confine/false_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/confine/false_spec.rb
puppet-3.8.5 spec/unit/confine/false_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/confine/false_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/confine/false_spec.rb
puppet-3.8.4 spec/unit/confine/false_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/confine/false_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/confine/false_spec.rb
puppet-3.8.3 spec/unit/confine/false_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/confine/false_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/confine/false_spec.rb
puppet-3.8.2 spec/unit/confine/false_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/confine/false_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/confine/false_spec.rb
puppet-3.8.1 spec/unit/confine/false_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/confine/false_spec.rb