Sha256: 5504df352ce145f20c4fde347371eda45ba596f37e7f4549491d27334ec7ef5e

Contents?: true

Size: 1010 Bytes

Versions: 4

Compression:

Stored size: 1010 Bytes

Contents

require 'spec_helper'

describe BackupJenkins::CLI do
  let(:aws) { stub }
  let(:backup) { stub }
  let(:config) { stub }

  before do
    BackupJenkins::AWS.stub(:new).and_return(aws)
    BackupJenkins::Backup.stub(:new).and_return(backup)
    BackupJenkins::Config.stub(:new).and_return(config)

    File.stub(:open).and_return(:IO)

    backup.stub(:do_backup)
    backup.stub(:tarball_filename).and_return("tarball_filename")

    aws.stub(:upload_file)
    aws.stub(:remove_old_files)
  end

  after do
    BackupJenkins::CLI.run
  end

  describe ".run" do
    it { BackupJenkins::AWS.should_receive(:new).with(config) }
    it { BackupJenkins::Backup.should_receive(:new).with(config) }
    it { BackupJenkins::Config.should_receive(:new) }
    it { backup.should_receive(:do_backup) }
    it { backup.should_receive(:tarball_filename).and_return("tarball_filename") }
    it { aws.should_receive(:upload_file).with("tarball_filename", :IO) }
    it { aws.should_receive(:remove_old_files) }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
backup_jenkins-0.0.5 spec/lib/backup_jenkins/cli_spec.rb
backup_jenkins-0.0.4 spec/lib/backup_jenkins/cli_spec.rb
backup_jenkins-0.0.3 spec/lib/backup_jenkins/cli_spec.rb
backup_jenkins-0.0.2 spec/lib/backup_jenkins/cli_spec.rb