Sha256: 248129a60231d6b5c487d0378532d59181860f60428ca6a7705d2fcbc7f4f0c8
Contents?: true
Size: 1.32 KB
Versions: 11
Compression:
Stored size: 1.32 KB
Contents
require 'spec_helper' require 'support/helpers' describe 'JSON equality operator' do include ChronoTest::Helpers::Adapter table 'json_test' before :all do ChronoModel::Json.create end after :all do ChronoModel::Json.drop end it { expect(adapter.select_value(%[ SELECT '{"a":1}'::json = '{"a":1}'::json ])).to eq AR_TRUE } it { expect(adapter.select_value(%[ SELECT '{"a":1}'::json = '{"a" : 1}'::json ])).to eq AR_TRUE } it { expect(adapter.select_value(%[ SELECT '{"a":1}'::json = '{"a":2}'::json ])).to eq AR_FALSE } it { expect(adapter.select_value(%[ SELECT '{"a":1,"b":2}'::json = '{"b":2,"a":1}'::json ])).to eq AR_TRUE } it { expect(adapter.select_value(%[ SELECT '{"a":1,"b":2,"x":{"c":4,"d":5}}'::json = '{"b":2, "x": { "d": 5, "c": 4}, "a":1}'::json ])).to eq AR_TRUE } context 'on a temporal table' do before :all do adapter.create_table table, :temporal => true do |t| t.json 'data' end adapter.execute %[ INSERT INTO #{table} ( data ) VALUES ( '{"a":1,"b":2}' ) ] end after :all do adapter.drop_table table end it { expect { adapter.execute "UPDATE #{table} SET data = NULL" }.to_not raise_error } it { expect { adapter.execute %[UPDATE #{table} SET data = '{"x":1,"y":2}'] }.to_not raise_error } end end
Version data entries
11 entries across 11 versions & 1 rubygems