Sha256: c69aec17f1d5cd50e1b90458686468c969a2d3b6dabdf7cfb2850523971594c0

Contents?: true

Size: 936 Bytes

Versions: 10

Compression:

Stored size: 936 Bytes

Contents

require File.join(File.dirname(__FILE__), 'helper')

class TestAttribute < Test::Unit::TestCase
  context 'DM::A::Sphinx::Attribute instance' do
    should 'typecast DateTime to Integer'
    should 'typecast Date to Integer'
    should 'typecast Time to Integer'
    should 'typecast BigDecimal to Float'
  end

  context 'DM::A::Sphinx::Resource#attribute class method' do
    setup do
      class ::Resource
        include DataMapper::SphinxResource
      end
    end

    DataMapper::Adapters::Sphinx::Attribute::TYPES.each do |type|
      should "accept a #{type} type" do
        assert_nothing_raised do
          Resource.class_eval do
            attribute :name, type
          end
        end
      end
    end

    should 'raise ArgumentError for unsupported type' do
      assert_raise(ArgumentError) do
        Resource.class_eval do
          attribute :name, Test::Unit::TestCase
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
bdimcheff-dm-sphinx-adapter-0.8.0 test/test_attribute.rb
shanna-dm-sphinx-adapter-0.6.1 test/test_attribute.rb
shanna-dm-sphinx-adapter-0.6.2 test/test_attribute.rb
shanna-dm-sphinx-adapter-0.6 test/test_attribute.rb
shanna-dm-sphinx-adapter-0.7.1 test/test_attribute.rb
shanna-dm-sphinx-adapter-0.7 test/test_attribute.rb
shanna-dm-sphinx-adapter-0.8.0 test/test_attribute.rb
dm-sphinx-adapter-0.7.1 test/test_attribute.rb
dm-sphinx-adapter-0.7 test/test_attribute.rb
dm-sphinx-adapter-0.6 test/test_attribute.rb