Sha256: c39a2718dbc374ed2499657d978269645d688e844e11c271c73c6be3c4c96077

Contents?: true

Size: 1.21 KB

Versions: 9

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'
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

9 entries across 9 versions & 2 rubygems

Version Path
amalgalite-1.5.0-x86-mingw32 spec/storage_map_spec.rb
amalgalite-1.5.0 spec/storage_map_spec.rb
amalgalite-1.4.1-x86-mingw32 spec/storage_map_spec.rb
amalgalite-1.4.1 spec/storage_map_spec.rb
amalgalite-1.4.0-x86-mingw32 spec/storage_map_spec.rb
amalgalite-1.4.0 spec/storage_map_spec.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/storage_map_spec.rb
amalgalite-1.3.0-x86-mswin32 spec/storage_map_spec.rb
amalgalite-1.3.0 spec/storage_map_spec.rb