summaryrefslogtreecommitdiffstats
path: root/spec/unit/interface/option_builder_spec.rb
blob: fae48324ee63428a3e3593111c7123d8c03c4f4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'puppet/interface/option_builder'

describe Puppet::Interface::OptionBuilder do
  let :face do Puppet::Interface.new(:option_builder_testing, '0.0.1') end

  it "should be able to construct an option without a block" do
    Puppet::Interface::OptionBuilder.build(face, "--foo").
      should be_an_instance_of Puppet::Interface::Option
  end

  describe "when using the DSL block" do
    it "should work with an empty block" do
      option = Puppet::Interface::OptionBuilder.build(face, "--foo") do
        # This block deliberately left blank.
      end

      option.should be_an_instance_of Puppet::Interface::Option
    end

    it "should support documentation declarations" do
      text = "this is the description"
      option = Puppet::Interface::OptionBuilder.build(face, "--foo") do
        desc text
      end
      option.should be_an_instance_of Puppet::Interface::Option
      option.desc.should == text
    end
  end
end