Sha256: 27f71efa75ede70caba6f904f1b5d73d78b68d8d7c6536bc2096c711abe10b88
Contents?: true
Size: 1.26 KB
Versions: 4
Compression:
Stored size: 1.26 KB
Contents
require 'spec_helper' describe Sdbport do before do @logger_stub = logger_stub @sdb_mock = sdb_mock @file_mock = mock 'file' @export = Sdbport::Domain::Export.new :name => 'name', :logger => @logger_stub, :access_key => 'the-key', :secret_key => 'the-secret', :region => 'us-west-1' end it "should export the domain to the given output" do File.should_receive(:open).with('/tmp/file', 'w'). and_return @file_mock data = { 'item1' => { 'attribute' => [ 'value' ] }, 'item2' => { 'attribute' => [ 'different' ] } } @sdb_mock.should_receive(:select_and_follow_tokens). with('select * from `name`'). and_return data @file_mock.should_receive(:write).with("[\"item1\",{\"attribute\":[\"value\"]}]") @file_mock.should_receive(:write).with("[\"item2\",{\"attribute\":[\"different\"]}]") @file_mock.should_receive(:write).with("\n").exactly(2).times @file_mock.should_receive(:close).and_return nil @export.export('/tmp/file').should be_true end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sdbport-0.3.0 | spec/domain/export_spec.rb |
sdbport-0.2.1 | spec/domain/export_spec.rb |
sdbport-0.2.0 | spec/domain/export_spec.rb |
sdbport-0.1.1 | spec/domain/export_spec.rb |