Sha256: 3aad53e80ac2ed92ae6311a852b4f64ca2c15e9d9e355e6286d5bceef9836682

Contents?: true

Size: 1.29 KB

Versions: 50

Compression:

Stored size: 1.29 KB

Contents

require 'rubygems'
require 'spec'

$: << File.expand_path(File.join(File.dirname(__FILE__),"..","lib"))
require 'amalgalite/type_maps/storage_map'

describe Amalgalite::TypeMaps::StorageMap do
  before(:each) do
    @map = Amalgalite::TypeMaps::StorageMap.new
  end

  describe "#bind_type_of" do

    it "Float is bound to DataType::FLOAT" do
      @map.bind_type_of( 3.14 ).should == ::Amalgalite::SQLite3::Constants::DataType::FLOAT
    end

    it "Fixnum is bound to DataType::INTGER" do
      @map.bind_type_of( 42 ).should == ::Amalgalite::SQLite3::Constants::DataType::INTEGER
    end

    it "nil is bound to DataType::NULL" do
      @map.bind_type_of( nil ).should == ::Amalgalite::SQLite3::Constants::DataType::NULL
    end

    it "::Amalgalite::Blob is bound to DataType::BLOB" do
      @map.bind_type_of( ::Amalgalite::Blob.new( :string => "testing mapping", :column => true )  ).should == ::Amalgalite::SQLite3::Constants::DataType::BLOB
    end

    it "everything else is bound to DataType::TEXT" do
      @map.bind_type_of( "everything else" ).should == ::Amalgalite::SQLite3::Constants::DataType::TEXT
    end

  end

  describe "#result_value_of" do
    it "returns the original object for everything passed in" do
      @map.result_value_of( "doesn't matter", 42 ).should == 42
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
amalgalite-0.15.0-x86-mingw32 spec/storage_map_spec.rb
amalgalite-0.15.0-x86-mswin32 spec/storage_map_spec.rb
amalgalite-0.15.0 spec/storage_map_spec.rb
amalgalite-0.12.0-x86-mingw32 spec/storage_map_spec.rb
amalgalite-0.12.0 spec/storage_map_spec.rb
amalgalite-0.12.0-x86-mswin32 spec/storage_map_spec.rb
amalgalite-0.11.0-x86-mswin32 spec/storage_map_spec.rb
amalgalite-0.11.0-x86-mingw32 spec/storage_map_spec.rb
amalgalite-0.10.2-x86-mswin32 spec/storage_map_spec.rb
amalgalite-0.10.2-x86-mingw32 spec/storage_map_spec.rb
amalgalite-0.10.1-x86-mswin32 spec/storage_map_spec.rb
amalgalite-0.10.1-x86-mingw32 spec/storage_map_spec.rb
amalgalite-0.10.0-x86-mswin32-60 spec/storage_map_spec.rb
amalgalite-0.11.0 spec/storage_map_spec.rb
amalgalite-0.10.2 spec/storage_map_spec.rb
amalgalite-0.10.0 spec/storage_map_spec.rb
amalgalite-0.10.1 spec/storage_map_spec.rb
amalgalite-0.2.0 spec/storage_map_spec.rb
amalgalite-0.2.1 spec/storage_map_spec.rb
amalgalite-0.2.3 spec/storage_map_spec.rb