Sha256: 926794df515ec138a4a6aacff46ecd29ed9ec1fc07b693739e245c0fe3a57e19

Contents?: true

Size: 1013 Bytes

Versions: 6

Compression:

Stored size: 1013 Bytes

Contents

require 'kontena/cli/nodes/health_command'

describe Kontena::Cli::Nodes::HealthCommand do
  include ClientHelpers
  include OutputHelpers

  before do
    allow(subject).to receive(:health_icon) {|health| health.inspect }
  end

  before do
    allow(client).to receive(:get).with('nodes/test-grid/node').and_return(node)
  end

  context "for an online node" do
    let :node do
      {
        "name" => "node",
        "node_number" => 4,
        "initial_member" => false,
        "connected" => true,
      }
    end

    it "outputs ok" do
      expect{subject.run(['node'])}.to output_lines [
        ":ok Node is online",
      ]
    end
  end

  context "for an offline node" do
    let :node do
      {
        "name" => "node",
        "node_number" => 4,
        "initial_member" => false,
        "connected" => false,
      }
    end

    it "fails as error" do
      expect{subject.run(['node'])}.to exit_with_error.and output_lines [
        ":offline Node is offline",
      ]
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kontena-cli-1.4.0.pre6 spec/kontena/cli/nodes/health_command_spec.rb
kontena-cli-1.4.0.pre5 spec/kontena/cli/nodes/health_command_spec.rb
kontena-cli-1.4.0.pre4 spec/kontena/cli/nodes/health_command_spec.rb
kontena-cli-1.4.0.pre3 spec/kontena/cli/nodes/health_command_spec.rb
kontena-cli-1.4.0.pre2 spec/kontena/cli/nodes/health_command_spec.rb
kontena-cli-1.4.0.pre1 spec/kontena/cli/nodes/health_command_spec.rb