From 267aa62ad1f3e1c7ca7d6f9fc54c763434a777e8 Mon Sep 17 00:00:00 2001 From: alex-lairan Date: Wed, 10 Jul 2019 16:29:02 +0200 Subject: [PATCH 1/3] Upgrade ROM version --- rom-mongo.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rom-mongo.gemspec b/rom-mongo.gemspec index 840851a..32b8bfa 100644 --- a/rom-mongo.gemspec +++ b/rom-mongo.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_runtime_dependency "rom-core", "~> 4.0" + spec.add_runtime_dependency "rom-core", "~> 5.0" spec.add_runtime_dependency "mongo", "~> 2.2" spec.add_runtime_dependency "origin" From 146fa9c841c5fcc440b4c519db26fe03b6e7f670 Mon Sep 17 00:00:00 2001 From: alex-lairan Date: Wed, 10 Jul 2019 16:29:54 +0200 Subject: [PATCH 2/3] Conform code to new api --- lib/rom/mongo/struct.rb | 2 +- spec/integration/gateway_spec.rb | 8 ++------ spec/shared/users.rb | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/rom/mongo/struct.rb b/lib/rom/mongo/struct.rb index 2123ad7..6cce4d3 100644 --- a/lib/rom/mongo/struct.rb +++ b/lib/rom/mongo/struct.rb @@ -3,7 +3,7 @@ module ROM module Mongo class Struct < ROM::Struct - constructor_type :symbolized + transform_keys(&:to_sym) end end end diff --git a/spec/integration/gateway_spec.rb b/spec/integration/gateway_spec.rb index 981de25..bc74ee3 100644 --- a/spec/integration/gateway_spec.rb +++ b/spec/integration/gateway_spec.rb @@ -58,9 +58,7 @@ it 'inserts a document into collection' do id = BSON::ObjectId.new - result = commands.try do - commands.create.call(_id: id, name: 'joe', email: 'a.joe@doe.org') - end + result = commands.create.call(_id: id, name: 'joe', email: 'a.joe@doe.org') expect(result) .to match_array([{ _id: id, name: 'joe', email: 'a.joe@doe.org' }]) @@ -71,9 +69,7 @@ it 'updates a document in the collection' do jane = users.by_name('Jane').one! - result = commands.try do - commands.update.by_name('Jane').call(email: 'jane.doe@test.com') - end + result = commands.update.by_name('Jane').call(email: 'jane.doe@test.com') expect(result).to match_array( [{ '_id' => BSON::ObjectId.from_string(jane._id), diff --git a/spec/shared/users.rb b/spec/shared/users.rb index 75f6967..2dc7108 100644 --- a/spec/shared/users.rb +++ b/spec/shared/users.rb @@ -12,7 +12,7 @@ schema do # TODO: we need ROM::Mongo::Types (similar to ROM::SQL::Types) - attribute :_id, ROM::Types.Definition(BSON::ObjectId) + attribute :_id, ROM::Types.Nominal(BSON::ObjectId) attribute :name, ROM::Types::String attribute :email, ROM::Types::String end From 7e07a92c8f6a2f78a26a31b5c385dae778d8cc0f Mon Sep 17 00:00:00 2001 From: alex-lairan Date: Wed, 10 Jul 2019 16:30:08 +0200 Subject: [PATCH 3/3] Change meta for version --- CHANGELOG.md | 7 +++++++ lib/rom/mongo/version.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fa18b0..73e7c12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## v0.3.0 2019-07-10 + +### Added + +* Added `rom-core` `5.0.2` support (alex-lairan) + + ## v0.2.0 2017-04-07 ### Added diff --git a/lib/rom/mongo/version.rb b/lib/rom/mongo/version.rb index cfc435f..db1331c 100644 --- a/lib/rom/mongo/version.rb +++ b/lib/rom/mongo/version.rb @@ -1,5 +1,5 @@ module ROM module Mongo - VERSION = '0.2.0'.freeze + VERSION = '0.3.0'.freeze end end