Sha256: ab1d7cb046d900d638c9c44592b1849c3d7c43366860c9b73087b72fae9ce400

Contents?: true

Size: 1.73 KB

Versions: 35

Compression:

Stored size: 1.73 KB

Contents

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

describe 'SimpleDB.get_attributes' 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 have no attributes for foo before put_attributes' do
      eventually do
        actual = AWS[:sdb].get_attributes(@domain_name, 'foo')
        actual.body['Attributes'].should be_empty
      end
    end

    it 'should return multi-value attributes from get_attributes' do
      AWS[:sdb].put_attributes(@domain_name, 'buzz', { "attr" => "foo" })
      AWS[:sdb].put_attributes(@domain_name, 'buzz', { "attr" => "foo2" })
      eventually do
        actual = AWS[:sdb].get_attributes(@domain_name, 'buzz')
        actual.body["Attributes"]["attr"].should == ['foo', 'foo2']
      end
    end

    it 'should have attributes for foo after put_attributes' do
      AWS[:sdb].put_attributes(@domain_name, 'foo', { :bar => :baz })
      eventually do
        actual = AWS[:sdb].get_attributes(@domain_name, 'foo')
        actual.body['Attributes'].should == { 'bar' => ['baz'] }
      end
    end

  end
  describe 'failure' do

    it 'should raise a BadRequest error if the domain does not exist' do
      lambda {
        AWS[:sdb].get_attributes('notadomain', 'notanattribute')
      }.should raise_error(Excon::Errors::BadRequest)
    end

    it 'should not raise an error if the attribute does not exist' do
      @domain_name = "fog_domain_#{Time.now.to_i}"
      AWS[:sdb].create_domain(@domain_name)
      AWS[:sdb].get_attributes(@domain_name, 'notanattribute')
      AWS[:sdb].delete_domain(@domain_name)
    end

  end
end

Version data entries

35 entries across 35 versions & 2 rubygems

Version Path
fog-0.3.17 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.16 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.15 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.14 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.13 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.12 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.11 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.10 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.9 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.8 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.7 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.6 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.5 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.4 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.3 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.2 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.1 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.3.0 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.2.30 spec/aws/requests/simpledb/get_attributes_spec.rb
fog-0.2.28 spec/aws/requests/simpledb/get_attributes_spec.rb