diff --git a/README.md b/README.md index dc597f3..0bce7e9 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ require 'rom/dynamodb' TABLE = "my-dynamodb-users-table" -# any other AWS::DynamoDB::Client options +# any other Aws::DynamoDB::Client options credentials = { region: 'us-east-1' } container = ROM.container(:dynamodb, credentials) do |rom| @@ -67,7 +67,7 @@ container = ROM.container(:dynamodb, credentials) do |rom| end end -relation = container.relation(:users) +relation = container.relations[:users] relation.count # => 1234 @@ -134,7 +134,7 @@ end # create fake logs container.commands[:logs][:create].call(logs) -relation = container.relation(:logs) +relation = container.relations[:logs] relation.count == num_of_logs # => true diff --git a/examples/composite_table.rb b/examples/composite_table.rb index 3d424e4..48cc2e4 100644 --- a/examples/composite_table.rb +++ b/examples/composite_table.rb @@ -2,7 +2,7 @@ TABLE = "my-dynamodb-users-table" -# any other AWS::DynamoDB::Client options +# any other Aws::DynamoDB::Client options credentials = { region: 'us-east-1' } container = ROM.container(:dynamodb, credentials) do |rom| @@ -43,7 +43,7 @@ def before_timestamp(time) # create fake logs container.commands[:logs][:create].call(logs) -relation = container.relation(:logs) +relation = container.relations[:logs] relation.count == num_of_logs # => true diff --git a/examples/simple_table.rb b/examples/simple_table.rb index 24ff857..089c3ca 100644 --- a/examples/simple_table.rb +++ b/examples/simple_table.rb @@ -2,7 +2,7 @@ TABLE = "my-dynamodb-users-table" -# any other AWS::DynamoDB::Client options +# any other Aws::DynamoDB::Client options credentials = { region: 'us-east-1' } container = ROM.container(:dynamodb, credentials) do |rom| @@ -36,7 +36,7 @@ def by_id(val) end end -relation = container.relation(:users) +relation = container.relations[:users] relation.count # => 1234 diff --git a/lib/rom/dynamodb/dataset.rb b/lib/rom/dynamodb/dataset.rb index b46939a..a6e1c35 100644 --- a/lib/rom/dynamodb/dataset.rb +++ b/lib/rom/dynamodb/dataset.rb @@ -290,6 +290,7 @@ def information def each(&block) each_item(build, &block) end + alias map each def connection @connection ||= Aws::DynamoDB::Client.new(config) diff --git a/rom-dynamodb.gemspec b/rom-dynamodb.gemspec index df3644f..acceae0 100644 --- a/rom-dynamodb.gemspec +++ b/rom-dynamodb.gemspec @@ -19,8 +19,8 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_runtime_dependency "rom", "~> 3.0.0.beta1" - spec.add_runtime_dependency "aws-sdk-core", ">= 2.1" + spec.add_runtime_dependency "rom", "~> 4.0.0" + spec.add_runtime_dependency "aws-sdk-core", "~> 2.10" spec.add_runtime_dependency "deep_merge", ">= 1.1.1" spec.add_development_dependency "json", "~> 2.0" @@ -31,5 +31,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency "yard", "~> 0.9" spec.add_development_dependency "redcarpet", "~> 3.4" spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0" - spec.add_development_dependency "factory_girl", "~> 4.5" + spec.add_development_dependency "factory_bot", "~> 4.8" end diff --git a/spec/factories/log.rb b/spec/factories/log.rb index 6c3e6b6..82964cc 100644 --- a/spec/factories/log.rb +++ b/spec/factories/log.rb @@ -1,4 +1,4 @@ -FactoryGirl.define do +FactoryBot.define do factory :log, class: Hash do transient do sequence_step 100 diff --git a/spec/factories/table.rb b/spec/factories/table.rb index cecc8cf..e1d1bd5 100644 --- a/spec/factories/table.rb +++ b/spec/factories/table.rb @@ -1,4 +1,4 @@ -FactoryGirl.define do +FactoryBot.define do factory :table, class: Hash do table_name { SecureRandom.uuid } @@ -8,7 +8,7 @@ schema({ id: :HASH }) global([]) - + local([]) end diff --git a/spec/factories/user.rb b/spec/factories/user.rb index 9b1d18a..9788f45 100644 --- a/spec/factories/user.rb +++ b/spec/factories/user.rb @@ -1,4 +1,4 @@ -FactoryGirl.define do +FactoryBot.define do factory :user, class: Hash do id { SecureRandom.uuid } diff --git a/spec/rom/dynamodb/command_spec.rb b/spec/rom/dynamodb/command_spec.rb index 0b34463..63d1a72 100644 --- a/spec/rom/dynamodb/command_spec.rb +++ b/spec/rom/dynamodb/command_spec.rb @@ -38,7 +38,7 @@ def alter_by_id(val) end } - let(:relation) { container.relation(descriptor) } + let(:relation) { container.relations[descriptor] } describe 'create' do subject(:command) { container.commands[descriptor][:create] } diff --git a/spec/rom/dynamodb/relation_spec.rb b/spec/rom/dynamodb/relation_spec.rb index c55e9a6..b6f98c1 100644 --- a/spec/rom/dynamodb/relation_spec.rb +++ b/spec/rom/dynamodb/relation_spec.rb @@ -50,7 +50,7 @@ def logged_at_between(after, before) end } - subject(:relation) { container.relation(descriptor) } + subject(:relation) { container.relations[descriptor] } before { container.commands[descriptor][:create].call(logs) } @@ -236,7 +236,7 @@ def by(val) end } - subject(:relation) { container.relation(descriptor) } + subject(:relation) { container.relations[descriptor] } before { container.commands[descriptor][:create].call(users) } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e121803..2d3b97f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,11 +1,13 @@ -require 'simplecov' -SimpleCov.start +unless ENV['TRAVIS'] + require 'simplecov' + SimpleCov.start +end $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require "securerandom" require "transproc/all" -require "factory_girl" +require "factory_bot" require "faker" require "rom/dynamodb" @@ -15,5 +17,5 @@ Dir[Pathname(__FILE__).dirname.join('factories/*.rb').to_s].each { |f| require f } RSpec.configure do |config| - config.include FactoryGirl::Syntax::Methods + config.include FactoryBot::Syntax::Methods end