Sha256: af4aff70125289a44c0e7f1f110fe0e572f5b96e802736e7c32cecd71b3618ba

Contents?: true

Size: 1.79 KB

Versions: 137

Compression:

Stored size: 1.79 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}"
      AWS[:sdb].create_domain(@domain_name)
    end

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

    it 'should return proper attributes when there are no items' do
      results = AWS[: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
      AWS[:sdb].put_attributes(@domain_name, 'foo', { :bar => :baz })
      results = AWS[: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 {
        AWS[:sdb].domain_metadata('notadomain')
      }.should raise_error(Excon::Errors::BadRequest)
    end

  end
end

Version data entries

137 entries across 137 versions & 2 rubygems

Version Path
fog-0.0.97 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.96 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.95 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.94 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.93 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.92 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.91 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.90 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.89 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.88 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.87 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.86 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.85 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.84 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.83 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.82 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.81 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.80 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.79 spec/aws/requests/simpledb/domain_metadata_spec.rb
fog-0.0.78 spec/aws/requests/simpledb/domain_metadata_spec.rb