Sha256: 8a92adc881e500328a1178f6940d230c3a030d2ccb7ddf0b56348113e0826ac6

Contents?: true

Size: 1.75 KB

Versions: 25

Compression:

Stored size: 1.75 KB

Contents

require File.dirname(__FILE__) + '/../../../spec_helper'

describe 'SimpleDB.domain_metadata' do
  describe 'success' do

    before(:each) do
      @domain_name = "fog_domain_#{Time.now.to_i}"
      sdb.create_domain(@domain_name)
    end

    after(:each) do
      sdb.delete_domain(@domain_name)
    end

    it 'should return proper attributes when there are no items' do
      results = sdb.domain_metadata(@domain_name)
      results.body['AttributeNameCount'].should == 0
      results.body['AttributeNamesSizeBytes'].should == 0
      results.body['AttributeValueCount'].should == 0
      results.body['AttributeValuesSizeBytes'].should == 0
      results.body['BoxUsage'].should be_a(Float)
      results.body['ItemCount'].should == 0
      results.body['ItemNamesSizeBytes'].should == 0
      results.body['RequestId'].should be_a(String)
      results.body['Timestamp'].should be_a(Time)
    end

    it 'should return proper attributes with items' do
      sdb.put_attributes(@domain_name, 'foo', { :bar => :baz })
      results = sdb.domain_metadata(@domain_name)
      results.body['AttributeNameCount'].should == 1
      results.body['AttributeNamesSizeBytes'].should == 3
      results.body['AttributeValueCount'].should == 1
      results.body['AttributeValuesSizeBytes'].should == 3
      results.body['BoxUsage'].should be_a(Float)
      results.body['ItemCount'].should == 1
      results.body['ItemNamesSizeBytes'].should == 3
      results.body['RequestId'].should be_a(String)
      results.body['Timestamp'].should be_a(Time)
    end

  end
  describe 'failure' do

    it 'should raise a BadRequest error if the domain does not exist' do
      lambda {
        sdb.domain_metadata('notadomain')
      }.should raise_error(Fog::Errors::BadRequest)
    end

  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
fog-0.0.29 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.28 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.27 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.26 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.25 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.24 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.23 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.22 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.21 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.20 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.19 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.18 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.17 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.16 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.15 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.14 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.13 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.12 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.11 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.10 spec/aws/requests/simpledb/domain_metadata_spec.rb