1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/spec/aws/simpledb/domain_metadata_spec.rb
2009-07-15 11:53:32 -07:00

41 lines
1.4 KiB
Ruby

require File.dirname(__FILE__) + '/../../spec_helper'
describe 'SimpleDB.domain_metadata' do
before(:all) do
@domain_name = "fog_domain_#{Time.now.to_i}"
sdb.create_domain(@domain_name)
end
after(:all) 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[:attribute_name_count].should == 0
results.body[:attribute_names_size_bytes].should == 0
results.body[:attribute_value_count].should == 0
results.body[:attribute_values_size_bytes].should == 0
results.body[:box_usage].should be_a(Float)
results.body[:item_count].should == 0
results.body[:item_names_size_bytes].should == 0
results.body[:request_id].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[:attribute_name_count].should == 1
results.body[:attribute_names_size_bytes].should == 3
results.body[:attribute_value_count].should == 1
results.body[:attribute_values_size_bytes].should == 3
results.body[:box_usage].should be_a(Float)
results.body[:item_count].should == 1
results.body[:item_names_size_bytes].should == 3
results.body[:request_id].should be_a(String)
results.body[:timestamp].should be_a(Time)
end
end