Sha256: e580108d340d856b55c5ef18037a3cf6fd2301446a3e298c0d018c6ce6f3f76f

Contents?: true

Size: 972 Bytes

Versions: 23

Compression:

Stored size: 972 Bytes

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

  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

23 entries across 23 versions & 3 rubygems

Version Path
fog4encbs-0.9.0.1 tests/core/attribute_tests.rb
fog4encbs-0.9.0 tests/core/attribute_tests.rb
fog-0.9.0 tests/core/attribute_tests.rb
fog-0.8.2 tests/core/attribute_tests.rb
fog-0.8.1 tests/core/attribute_tests.rb
fog-0.8.0 tests/core/attribute_tests.rb
fog-0.7.2 tests/core/attribute_tests.rb
fog-0.7.1 tests/core/attribute_tests.rb
fog-0.7.0 tests/core/attribute_tests.rb
fog-0.6.0 tests/core/attribute_tests.rb
fog-0.5.3 tests/core/attribute_tests.rb
fog-0.5.2 tests/core/attribute_tests.rb
fog-0.5.1 tests/core/attribute_tests.rb
fog-0.5.0 tests/core/attribute_tests.rb
phpfog-fog-0.4.1.3 tests/core/attribute_tests.rb
phpfog-fog-0.4.1.2 tests/core/attribute_tests.rb
phpfog-fog-0.4.1.1 tests/core/attribute_tests.rb
phpfog-fog-0.4.1 tests/core/attribute_tests.rb
fog-0.4.1 tests/core/attribute_tests.rb
fog-0.4.0 tests/core/attribute_tests.rb