Sha256: 5c4c148195e5abccbeb110e19ea2dae03b8ba094c0da8f641baa1bf727f5f79a

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

# encoding: utf-8

require 'spec_helper'
require "zabbix-ruby-client/cli"

describe ZabbixRubyClient::Cli do

  before :each do
    @cli = ZabbixRubyClient::Cli.new(
      [],
      {
        'configfile' => 'config.yml',
        'taskfile' => 'minutely.yml'
      }
    )
    @testdir = File.join('spec','files','test-client')
    @cli.shell.mute do
      @cli.init(@testdir)
    end
    @oldpwd = Dir.pwd
    Dir.chdir @testdir
  end

  after :each do
    Dir.chdir @oldpwd
    FileUtils.rm_rf @testdir if Dir.exists? @testdir
  end

  it "init creates a working directory" do
    expect(File.file? 'Gemfile').to be_truthy
  end

  it "show displays the list of data collected" do
    allow(ZabbixRubyClient::Runner).to receive(:new).and_return(Object)
    allow(Object).to receive(:collect)
    allow(Object).to receive(:show)
    @cli.shell.mute do
      @cli.show
    end
  end

  it "upload collects and uploads the data from system" do
    allow(ZabbixRubyClient::Runner).to receive(:new).and_return(Object)
    allow(Object).to receive(:collect)
    allow(Object).to receive(:upload)
    @cli.shell.mute do
      @cli.upload
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
zabbix-ruby-client-0.1.3 spec/lib/cli_spec.rb
zabbix-ruby-client-0.1.2 spec/lib/cli_spec.rb
zabbix-ruby-client-0.1.1 spec/lib/cli_spec.rb
zabbix-ruby-client-0.1.0 spec/lib/cli_spec.rb
zabbix-ruby-client-0.0.23 spec/lib/cli_spec.rb
zabbix-ruby-client-0.0.22 spec/lib/cli_spec.rb
zabbix-ruby-client-0.0.21 spec/lib/cli_spec.rb