Sha256: 90abf512332de7e19957fa78ce4d7774efeaefc51ab078819acff5bd4edcee14

Contents?: true

Size: 737 Bytes

Versions: 46

Compression:

Stored size: 737 Bytes

Contents

require "spec_helper"

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

    @node = Chef::Node.new
    allow(@node).to receive :save
    @node.tags << "sadtag" << "happytag"
    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 delete tags on a node" do
      expect(@node.tags).to eq(%w{sadtag happytag})
      @knife.run
      expect(@node.tags).to eq(["happytag"])
      expect(@stderr.string).to match(/deleted.+sadtag/i)
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
chef-16.8.14-universal-mingw32 spec/unit/knife/tag_delete_spec.rb
chef-16.8.14 spec/unit/knife/tag_delete_spec.rb
chef-16.8.9-universal-mingw32 spec/unit/knife/tag_delete_spec.rb
chef-16.8.9 spec/unit/knife/tag_delete_spec.rb
chef-16.7.61-universal-mingw32 spec/unit/knife/tag_delete_spec.rb
chef-16.7.61 spec/unit/knife/tag_delete_spec.rb