Sha256: 2b950f755aaede18cb6a0ad5b0ac0c6b3d594d957320cdc2f691155c44cb6f7d

Contents?: true

Size: 577 Bytes

Versions: 7

Compression:

Stored size: 577 Bytes

Contents

require 'pathname'
require Pathname(__FILE__).dirname.parent.expand_path + 'spec_helper'

describe DataMapper::Types::Json do
  before(:all) do
    class JsonTest
      include DataMapper::Resource

      property :id, Serial
      property :json, Json
    end
    JsonTest.auto_migrate!
  end

  it "should work" do
    repository(:default) do
      JsonTest.create(:json => '[1, 2, 3]')
    end

    JsonTest.first.json.should == [1, 2, 3]
  end

  it 'should immediately typecast supplied values' do
    JsonTest.new(:json => '[1, 2, 3]').json.should == [1, 2, 3]
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dm-types-0.9.4 spec/integration/json_spec.rb
dm-types-0.9.6 spec/integration/json_spec.rb
dm-types-0.9.5 spec/integration/json_spec.rb
dm-types-0.9.3 spec/integration/json_spec.rb
dm-types-0.9.9 spec/integration/json_spec.rb
dm-types-0.9.8 spec/integration/json_spec.rb
dm-types-0.9.7 spec/integration/json_spec.rb