Sha256: f72b757a3ce36581ed4e72ad7d5e90cde3e1a045e13e03d301f3b5316558a5f9

Contents?: true

Size: 709 Bytes

Versions: 4

Compression:

Stored size: 709 Bytes

Contents

require "knife_spec_helper"

describe Chef::Knife::TagCreate do
  before(:each) do
    Chef::Config[:node_name] = "webmonkey.example.com"
    @knife = Chef::Knife::TagCreate.new
    @knife.name_args = [ Chef::Config[:node_name], "happytag" ]

    @node = Chef::Node.new
    allow(@node).to receive :save
    allow(Chef::Node).to receive(:load).and_return @node
    @stderr = StringIO.new
    allow(@knife.ui).to receive(:stderr).and_return(@stderr)
  end

  describe "run" do
    it "can create tags on a node" do
      @knife.run
      expect(@node.tags).to eq(["happytag"])
      expect(@stderr.string).to match(/created tags happytag.+node webmonkey.example.com/i)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
knife-17.10.163 spec/unit/knife/tag_create_spec.rb
knife-18.2.7 spec/unit/knife/tag_create_spec.rb
knife-18.2.5 spec/unit/knife/tag_create_spec.rb
knife-18.0.185 spec/unit/knife/tag_create_spec.rb