Sha256: 8156c9d93e8f3c745a10b21d765059bfef3c36c359e279584ab9c67ad8ea98f8

Contents?: true

Size: 1.22 KB

Versions: 7

Compression:

Stored size: 1.22 KB

Contents

class FogAttributeTestModel < Fog::Model
  attribute :key, :aliases => 'keys', :squash => "id"
  attribute :time, :type => :time
end

Shindo.tests('Fog::Attributes', 'core') do

  @model = FogAttributeTestModel.new

  tests('squash') do

    tests('"keys" => {:id => "value"}').returns('value') do
      @model.merge_attributes("keys" => {:id => "value"})
      @model.key
    end

    tests('"keys" => {"id" => "value"}').returns('value') do
      @model.merge_attributes("keys" => {'id' => "value"})
      @model.key
    end

    tests('"keys" => {"id" => false}').returns(false) do
      @model.merge_attributes("keys" => {'id' => false })
      @model.key
    end

    tests('"keys" => {:id => false}').returns(false) do
      @model.merge_attributes("keys" => {:id => false })
      @model.key
    end
  end

  tests(':type => :time') do

    @time  = Time.now

    tests(':time => nil').returns(nil) do
      @model.merge_attributes(:time => nil)
      @model.time
    end

    tests(':time => ""').returns('') do
      @model.merge_attributes(:time => '')
      @model.time
    end

    tests(':time => "#{@time.to_s}"').returns(Time.parse(@time.to_s)) do
      @model.merge_attributes(:time => @time.to_s)
      @model.time
    end

  end

end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/fog/tests/core/attribute_tests.rb
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/fog/tests/core/attribute_tests.rb
fog-1.0.0 tests/core/attribute_tests.rb
brightbox-cli-0.13.1 lib/brightbox-cli/vendor/fog/tests/core/attribute_tests.rb
brightbox-cli-0.13.0 lib/brightbox-cli/vendor/fog/tests/core/attribute_tests.rb
fog-0.11.0 tests/core/attribute_tests.rb
fog-0.10.0 tests/core/attribute_tests.rb