Sha256: 3de266a3576522a8a3da110fa2b467e1e2e99705cfcc6fd5d207f08e44c070ad

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 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_true
  end

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

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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zabbix-ruby-client-0.0.20 spec/lib/cli_spec.rb
zabbix-ruby-client-0.0.19 spec/lib/cli_spec.rb
zabbix-ruby-client-0.0.18 spec/lib/cli_spec.rb