Sha256: dc6aaea03e8edbbde112c06611cc36076006e8e015a5ae416593f302ea610852

Contents?: true

Size: 880 Bytes

Versions: 63

Compression:

Stored size: 880 Bytes

Contents

require "spec_helper"
require "shelly/backup"

describe Shelly::Backup do
  before do
    @client = mock
    Shelly::Client.stub(:new).and_return(@client)
  end

  it "should assign attributes" do
    backup = Shelly::Backup.new(attributes)

    backup.code_name.should == "foo"
    backup.filename.should == "backup.tar.gz"
    backup.human_size.should == "2KB"
    backup.size.should == 2048
  end

  describe "#download" do
    it "should download given backup via API file with filename to which backup will be downloaded" do
      callback = lambda {}
      @client.should_receive(:download_backup).with("foo", "backup.tar.gz", callback)
      backup = Shelly::Backup.new(attributes)
      backup.download(callback)
    end
  end

  def attributes
    {"code_name" => "foo",
    "filename"   => "backup.tar.gz",
    "human_size" => "2KB",
    "size"       => 2048}
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
shelly-0.1.18 spec/shelly/backup_spec.rb
shelly-0.1.17 spec/shelly/backup_spec.rb
shelly-0.1.16 spec/shelly/backup_spec.rb
shelly-0.1.15 spec/shelly/backup_spec.rb
shelly-0.1.14 spec/shelly/backup_spec.rb
shelly-0.1.13 spec/shelly/backup_spec.rb
shelly-0.1.12 spec/shelly/backup_spec.rb
shelly-0.1.11 spec/shelly/backup_spec.rb
shelly-0.1.10 spec/shelly/backup_spec.rb
shelly-0.1.9 spec/shelly/backup_spec.rb
shelly-0.1.8 spec/shelly/backup_spec.rb
shelly-0.1.7 spec/shelly/backup_spec.rb
shelly-0.1.6 spec/shelly/backup_spec.rb
shelly-0.1.5 spec/shelly/backup_spec.rb
shelly-0.1.4.pre2 spec/shelly/backup_spec.rb
shelly-0.1.4.pre spec/shelly/backup_spec.rb
shelly-0.1.3 spec/shelly/backup_spec.rb
shelly-0.1.2 spec/shelly/backup_spec.rb
shelly-0.1.1 spec/shelly/backup_spec.rb
shelly-0.1.0 spec/shelly/backup_spec.rb