Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for Rom v4, Restrict to AWS SDK v2, and Fix FactoryGirl/Bot deprecation. #1

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -67,7 +67,7 @@ container = ROM.container(:dynamodb, credentials) do |rom|
end
end

relation = container.relation(:users)
relation = container.relations[:users]

relation.count # => 1234

Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions examples/composite_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions examples/simple_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -36,7 +36,7 @@ def by_id(val)
end
end

relation = container.relation(:users)
relation = container.relations[:users]

relation.count # => 1234

Expand Down
1 change: 1 addition & 0 deletions lib/rom/dynamodb/dataset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions rom-dynamodb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
2 changes: 1 addition & 1 deletion spec/factories/log.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :log, class: Hash do
transient do
sequence_step 100
Expand Down
4 changes: 2 additions & 2 deletions spec/factories/table.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :table, class: Hash do
table_name { SecureRandom.uuid }

Expand All @@ -8,7 +8,7 @@
schema({ id: :HASH })

global([])

local([])
end

Expand Down
2 changes: 1 addition & 1 deletion spec/factories/user.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :user, class: Hash do
id { SecureRandom.uuid }

Expand Down
2 changes: 1 addition & 1 deletion spec/rom/dynamodb/command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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] }
Expand Down
4 changes: 2 additions & 2 deletions spec/rom/dynamodb/relation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand Down Expand Up @@ -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) }

Expand Down
10 changes: 6 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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