Sha256: a921f80ae4e5f913ce2e9d378f35a1846ff7a6dd88104676ae7c01ce990b3754

Contents?: true

Size: 612 Bytes

Versions: 3

Compression:

Stored size: 612 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "ActiverecordPostgresHstore" do
  it "should convert hash to hstore string" do
    {:a => 1, :b => 2}.to_hstore.should == "('a'=>'1') || ('b'=>'2')"
  end

  it "should convert hstore string to hash" do
    '"a"=>"1", "b"=>"2"'.from_hstore.should == {'a' => '1', 'b' => '2'}
  end
 
  it "should quote correctly" do
    {:a => "'a'"}.to_hstore.should == "('a'=>'''a''')"
  end

  it "should convert empty hash" do
    {}.to_hstore.should == "''"
  end

  it "should convert empty string" do
    ''.from_hstore.should == {}
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activerecord-postgres-hstore-0.0.4 spec/activerecord-postgres-hstore_spec.rb
activerecord-postgres-hstore-0.0.3 spec/activerecord-postgres-hstore_spec.rb
activerecord-postgres-hstore-0.0.2 spec/activerecord-postgres-hstore_spec.rb