repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/integration/mapper/unwrap_spec.rb | core/spec/integration/mapper/unwrap_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Mapper definition DSL' do
include_context 'container'
include_context 'users and tasks'
let(:header) { mapper.header }
describe 'unwrapping relation mapper' do
before do
configuration.relation(:tasks) do
def with_user
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/integration/mapper/renaming_attributes_spec.rb | core/spec/integration/mapper/renaming_attributes_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Mappers / Renaming attributes' do
include_context 'container'
before do
configuration.relation(:addresses)
configuration.relation(:users) do
def with_address
join(addresses)
end
def with_addresses
join... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/integration/mapper/overwrite_attributes_value_spec.rb | core/spec/integration/mapper/overwrite_attributes_value_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Mappers / Attributes value' do
include_context 'container'
before do
configuration.relation(:users)
end
it 'allows to manipulate attribute value' do
class Test::UserMapper < ROM::Mapper
relation :users
attribute :id
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/integration/mapper/ungroup_spec.rb | core/spec/integration/mapper/ungroup_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Mapper definition DSL' do
include_context 'container'
before do
configuration.relation(:users)
users = configuration.default.dataset(:users)
users.insert(name: 'Joe', emails: [
{ address: 'joe@home.org', type: 'home' },
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/integration/mapper/exclude_spec.rb | core/spec/integration/mapper/exclude_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Mapper definition DSL' do
include_context 'container'
before do
configuration.relation(:users)
users = configuration.default.dataset(:users)
users.insert(name: 'Joe', email: 'joe@doe.com')
users.insert(name: 'Jane', email: 'jan... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/integration/mapper/registering_custom_mappers_spec.rb | core/spec/integration/mapper/registering_custom_mappers_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Registering Custom Mappers' do
include_context 'container'
include_context 'users and tasks'
it 'allows registering arbitrary objects as mappers' do
model = Struct.new(:name, :email)
mapper = lambda { |users|
users.map { |tuple|... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/integration/mapper/definition_dsl_spec.rb | core/spec/integration/mapper/definition_dsl_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Mapper definition DSL' do
include_context 'container'
include_context 'users and tasks'
let(:header) { mapper.header }
before do
configuration.relation(:users) do
def email_index
project(:email)
end
end
end
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/integration/mapper/reusing_mappers_spec.rb | core/spec/integration/mapper/reusing_mappers_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Reusing mappers' do
it 'allows using another mapper in mapping definitions' do
class Test::TaskMapper < ROM::Mapper
attribute :title
end
class Test::UserMapper < ROM::Mapper
attribute :name
group :tasks, mapper: Test:... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/custom/mappers/user_list.rb | core/spec/fixtures/custom/mappers/user_list.rb | # frozen_string_literal: true
module My
module Namespace
class UserList
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/custom/relations/users.rb | core/spec/fixtures/custom/relations/users.rb | # frozen_string_literal: true
module My
module Namespace
class Users
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/custom/commands/create_user.rb | core/spec/fixtures/custom/commands/create_user.rb | # frozen_string_literal: true
module My
module Namespace
class CreateUser
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/app/mappers/user_list.rb | core/spec/fixtures/app/mappers/user_list.rb | # frozen_string_literal: true
class UserList
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/app/relations/users.rb | core/spec/fixtures/app/relations/users.rb | # frozen_string_literal: true
class Users
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/app/commands/create_user.rb | core/spec/fixtures/app/commands/create_user.rb | # frozen_string_literal: true
class CreateUser
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/app/my_relations/users.rb | core/spec/fixtures/app/my_relations/users.rb | # frozen_string_literal: true
class Users
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/app/my_mappers/user_list.rb | core/spec/fixtures/app/my_mappers/user_list.rb | # frozen_string_literal: true
class UserList
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/app/my_commands/create_user.rb | core/spec/fixtures/app/my_commands/create_user.rb | # frozen_string_literal: true
class CreateUser
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/wrong/mappers/customer_list.rb | core/spec/fixtures/wrong/mappers/customer_list.rb | # frozen_string_literal: true
module My
module NewNamespace
module Foo
class CustomerList
end
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/wrong/relations/customers.rb | core/spec/fixtures/wrong/relations/customers.rb | # frozen_string_literal: true
module My
module NewNamespace
module Foo
class Customers
end
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/wrong/commands/create_customer.rb | core/spec/fixtures/wrong/commands/create_customer.rb | # frozen_string_literal: true
module My
module NewNamespace
module Foo
class CreateCustomer
end
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/custom_namespace/mappers/customer_list.rb | core/spec/fixtures/custom_namespace/mappers/customer_list.rb | # frozen_string_literal: true
module My
module Namespace
module Mappers
class CustomerList
end
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/custom_namespace/relations/customers.rb | core/spec/fixtures/custom_namespace/relations/customers.rb | # frozen_string_literal: true
module My
module Namespace
module Relations
class Customers
end
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/custom_namespace/commands/create_customer.rb | core/spec/fixtures/custom_namespace/commands/create_customer.rb | # frozen_string_literal: true
module My
module Namespace
module Commands
class CreateCustomer
end
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/lib/persistence/mappers/user_list.rb | core/spec/fixtures/lib/persistence/mappers/user_list.rb | # frozen_string_literal: true
module Persistence
module Mappers
class UserList
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/lib/persistence/relations/users.rb | core/spec/fixtures/lib/persistence/relations/users.rb | # frozen_string_literal: true
module Persistence
module Relations
class Users
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/lib/persistence/commands/create_user.rb | core/spec/fixtures/lib/persistence/commands/create_user.rb | # frozen_string_literal: true
module Persistence
module Commands
class CreateUser
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/lib/persistence/my_relations/users.rb | core/spec/fixtures/lib/persistence/my_relations/users.rb | # frozen_string_literal: true
module Persistence
module MyRelations
class Users
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/lib/persistence/my_mappers/user_list.rb | core/spec/fixtures/lib/persistence/my_mappers/user_list.rb | # frozen_string_literal: true
module Persistence
module MyMappers
class UserList
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/fixtures/lib/persistence/my_commands/create_user.rb | core/spec/fixtures/lib/persistence/my_commands/create_user.rb | # frozen_string_literal: true
module Persistence
module MyCommands
class CreateUser
end
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/test/memory_repository_lint_test.rb | core/spec/test/memory_repository_lint_test.rb | # frozen_string_literal: true
require 'rom/core'
require 'rom/memory'
require 'rom/lint/test'
require 'minitest/autorun'
class MemoryRepositoryLintTest < Minitest::Test
include ROM::Lint::TestGateway
def setup
@gateway = ROM::Memory::Gateway
@identifier = :memory
end
def gateway_instance
ROM::M... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/gateway_spec.rb | core/spec/unit/rom/gateway_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ROM::Gateway do
subject(:gateway) { Class.new(ROM::Gateway).new }
describe '.setup' do
it 'sets up a gateway based on a type' do
gateway_class = Class.new(ROM::Gateway) do
attr_reader :args
def initialize(*args)
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/create_container_spec.rb | core/spec/unit/rom/create_container_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ROM::CreateContainer, '#finalize' do
describe '#finalize' do
include_context 'container'
it 'can register multiple relations with same dataset' do
configuration
apples = Class.new(ROM::Relation[:memory]) do
schema(:frui... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/configuration_spec.rb | core/spec/unit/rom/configuration_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ROM::Configuration do
it 'is configurable via settings hash' do
configuration = ROM::Configuration.new(:memory, 'something', infer_schema: false)
expect(configuration.config.gateways.default.infer_schema).to be(false)
configuration = R... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema_spec.rb | core/spec/unit/rom/schema_spec.rb | # frozen_string_literal: true
RSpec.describe ROM::Schema do
describe '#to_h' do
it 'returns hash with attributes' do
attrs = {
id: define_attr_info(:Integer, name: :id),
name: define_attr_info(:String, name: :name)
}
schema = ROM::Schema.define(:name, attributes: attrs.values)
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/command_compiler_spec.rb | core/spec/unit/rom/command_compiler_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'ROM::CommandCompiler' do
include_context 'gateway only'
include_context 'users and tasks'
let(:users) do
Class.new(ROM::Memory::Relation) {
def by_id(id)
restrict(id: id)
end
}.new(users_dataset)
end
subject(:c... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/mapper_spec.rb | core/spec/unit/rom/mapper_spec.rb | # frozen_string_literal: true
require 'ostruct'
RSpec.describe ROM::Mapper do
subject(:mapper) { mapper_class.build }
let(:mapper_class) do
user_model = self.user_model
Class.new(ROM::Mapper) do
attribute :id
attribute :name
model user_model
end
end
let(:relation) do
[{ id... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/commands_spec.rb | core/spec/unit/rom/commands_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Commands' do
include_context 'gateway only'
include_context 'users and tasks'
let(:users_relation) do
Class.new(ROM::Memory::Relation) do
def by_id(id)
restrict(id: id)
end
end.new(users_dataset)
end
describe '... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/mapper_compiler_spec.rb | core/spec/unit/rom/mapper_compiler_spec.rb | # frozen_string_literal: true
RSpec.describe ROM::MapperCompiler, '#call' do
subject(:mapper_compiler) do
Class.new(ROM::MapperCompiler) do
mapper_options(reject_keys: true)
end.new
end
let(:ast) do
ROM::Relation.new([], schema: define_schema(:users, id: :Integer, name: :String)).to_ast
end
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/enumerable_dataset_spec.rb | core/spec/unit/rom/enumerable_dataset_spec.rb | # frozen_string_literal: true
require 'rom/enumerable_dataset'
RSpec.describe ROM::EnumerableDataset do
let(:klass) do
Class.new do
include ROM::EnumerableDataset
def self.row_proc
-> i { i.transform_keys(&:to_sym) }
end
end
end
it_behaves_like 'an enumerable dataset'
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/relation_spec.rb | core/spec/unit/rom/relation_spec.rb | # frozen_string_literal: true
require 'rom/memory'
RSpec.describe ROM::Relation do
subject(:relation) do
Class.new(ROM::Relation) do
adapter :test
schema(:users) { nil }
end.new(dataset)
end
let(:dataset) { ROM::Memory::Dataset.new([jane, joe]) }
let(:jane) { { id: 1, name: 'Jane' } }
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/plugin_spec.rb | core/spec/unit/rom/plugin_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'ROM::PluginRegistry' do
include_context 'container'
before do
Test::ConfigurationPlugin = Module.new
Test::CommandPlugin = Module.new
Test::MapperPlugin = Module.new
Test::RelationPlugin = Module.new do
def plug... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/memoizable_spec.rb | core/spec/unit/rom/memoizable_spec.rb | # frozen_string_literal: true
require 'rom/support/memoizable'
RSpec.describe ROM::Memoizable, '.memoize' do
subject(:object) do
Class.new do
include ROM::Memoizable
def foo
%w[a ab abc].max
end
memoize :foo
def bar(_arg)
{ a: '1', b: '2' }
end
memoize... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/cache_spec.rb | core/spec/unit/rom/cache_spec.rb | # frozen_string_literal: true
require 'rom/cache'
RSpec.describe ROM::Cache do
subject(:cache) { ROM::Cache.new }
describe '#fetch_or_store' do
it 'returns existing object' do
obj = 'foo'
expect(cache.fetch_or_store(obj) { obj })
expect(cache.fetch_or_store(obj)).to be(obj)
end
end
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/auto_curry_spec.rb | core/spec/unit/rom/auto_curry_spec.rb | # frozen_string_literal: true
require 'rom/auto_curry'
RSpec.describe ROM::AutoCurry do
subject(:object) { klass.new }
let(:klass) do
Class.new do
extend ROM::AutoCurry
def self.curried(*)
self
end
def initialize(*); end
def arity0
0
end
def arity... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/registry_spec.rb | core/spec/unit/rom/registry_spec.rb | # frozen_string_literal: true
require 'rom/registry'
RSpec.shared_examples_for 'registry fetch' do
it 'raises an ArgumentError when nil is used as a key' do
expect {
registry.public_send(fetch_method, nil)
}.to raise_error(ArgumentError, 'key cannot be nil')
end
it 'returns registered element ide... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/container_spec.rb | core/spec/unit/rom/container_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ROM::Container do
include_context 'container'
include_context 'users and tasks'
before do
users = Class.new(ROM::Relation[:memory]) do
schema(:users) do
attribute :name, ROM::Types::String
attribute :email, ROM::Types:... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/association_set_spec.rb | core/spec/unit/rom/association_set_spec.rb | # frozen_string_literal: true
RSpec.describe ROM::AssociationSet do
subject(:set) { ROM::AssociationSet[:projects].build(elements) }
describe '.[]' do
it 'builds a class with the provided identifier' do
klass = ROM::AssociationSet[:users]
expect(klass.name).to eql('ROM::AssociationSet[:users]')
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/environment_spec.rb | core/spec/unit/rom/environment_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ROM::Environment do
let(:environment) { ROM::Environment.new(*params) }
let(:params) { [] }
let(:gateways) { environment.gateways }
let(:gateways_map) { environment.gateways_map }
context 'with an adapter identifier' do
let(:params) { [... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/array_dataset_spec.rb | core/spec/unit/rom/array_dataset_spec.rb | # frozen_string_literal: true
require 'rom/array_dataset'
RSpec.describe ROM::ArrayDataset do
let(:klass) do
Class.new do
include ROM::ArrayDataset
def self.row_proc
-> i { i.transform_keys(&:to_sym) }
end
end
end
it_behaves_like 'an enumerable dataset' do
describe '#flat... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/struct_compiler_spec.rb | core/spec/unit/rom/struct_compiler_spec.rb | # frozen_string_literal: true
require 'rom/struct_compiler'
RSpec.describe ROM::StructCompiler, '#call' do
subject(:struct_compiler) { ROM::StructCompiler.new }
def attr_ast(name, type, **_opts)
[name, ROM::Types.const_get(type).to_ast, alias: false, wrapped: false]
end
let(:input) do
[:users, [[:at... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/configurable_spec.rb | core/spec/unit/rom/configurable_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ROM::Configurable do
let(:klass) { Class.new { include ROM::Configurable } }
let(:object) { klass.new }
let(:config) { object.config }
it 'exposes the config property' do
expect { config }.not_to raise_error
end
it 'is configurable v... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/commands/graph_spec.rb | core/spec/unit/rom/commands/graph_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'dry-struct'
RSpec.describe ROM::Commands::Graph do
shared_examples_for 'a persisted graph' do
it 'returns nested results' do
expect(command.call).to match_array([
# parent users
[
{ name: 'Jane' }
],
[
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/commands/pre_and_post_processors_spec.rb | core/spec/unit/rom/commands/pre_and_post_processors_spec.rb | # frozen_string_literal: true
require 'rom/command'
require 'rom/memory'
RSpec.describe ROM::Commands::Create[:memory], 'before/after hooks' do
let(:relation) do
spy(:relation)
end
describe '#before' do
subject(:command) do
Class.new(ROM::Commands::Create[:memory]) do
before :init
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/commands/lazy_spec.rb | core/spec/unit/rom/commands/lazy_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ROM::Commands::Lazy do
include_context 'container'
let(:create_user) { container.commands[:users].create }
let(:update_user) { container.commands[:users].update }
let(:delete_user) { container.commands[:users].delete }
let(:create_task) { ... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/processor/transproc_spec.rb | core/spec/unit/rom/processor/transproc_spec.rb | # frozen_string_literal: true
RSpec.describe ROM::Processor::Transproc do
subject(:transproc) { ROM::Processor::Transproc.build(binding, header) }
let(:binding) { nil }
let(:header) { ROM::Header.coerce(attributes, options) }
let(:options) { {} }
context 'no mapping' do
let(:attributes) { [[:name]] }
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/memory/gateway_spec.rb | core/spec/unit/rom/memory/gateway_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rom/lint/spec'
require 'rom/memory'
RSpec.describe ROM::Memory::Gateway do
let(:gateway) { ROM::Memory::Gateway }
let(:uri) { nil }
it_behaves_like 'a rom gateway' do
let(:identifier) { :memory }
end
end
| ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/memory/inheritance_spec.rb | core/spec/unit/rom/memory/inheritance_spec.rb | # frozen_string_literal: true
require 'rom/memory'
RSpec.describe ROM::Memory::Relation, '.inherited' do
subject(:relation) do
Class.new(ROM::Relation[:test]) do
schema(:users) do
attribute :name, ROM::Types::String
end
end.new([])
end
before do
module Test
module AnotherA... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/memory/commands_spec.rb | core/spec/unit/rom/memory/commands_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rom/memory'
RSpec.describe ROM::Memory::Commands do
let(:relation) do
Class.new(ROM::Relation[:memory]) do
schema do
attribute :id, ROM::Memory::Types::Integer
attribute :name, ROM::Memory::Types::String
end
end.new(ROM... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/memory/relation_spec.rb | core/spec/unit/rom/memory/relation_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rom/lint/spec'
require 'rom/memory/dataset'
require 'rom/memory/relation'
RSpec.describe ROM::Memory::Relation do
subject(:relation) do
Class.new(ROM::Memory::Relation) do
schema do
attribute :name, ROM::Types::String
attribute ... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/memory/dataset_spec.rb | core/spec/unit/rom/memory/dataset_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rom/lint/spec'
require 'rom/memory/dataset'
RSpec.describe ROM::Memory::Dataset do
subject(:dataset) { ROM::Memory::Dataset.new(data) }
let(:data) do
[
{ name: 'Jane', email: 'jane@doe.org', age: 10 },
{ name: 'Jade', email: 'jade@doe.... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/memory/storage_spec.rb | core/spec/unit/rom/memory/storage_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rom/memory/storage'
RSpec.describe ROM::Memory::Storage do
describe 'thread safe' do
let(:threads) { 4 }
let(:operations) { 5000 }
describe 'data' do
it 'create datasets properly' do
storage = ROM::Memory::Storage.new
t... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/plugins/command/schema_spec.rb | core/spec/unit/rom/plugins/command/schema_spec.rb | # frozen_string_literal: true
require 'rom/relation'
require 'rom/command'
require 'rom/plugins/command/schema'
RSpec.describe ROM::Plugins::Command::Schema do
describe '.build' do
let(:command_class) do
Class.new(ROM::Command) { use :schema }
end
context 'when relation has no schema defined' do
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/plugins/command/timestamps_spec.rb | core/spec/unit/rom/plugins/command/timestamps_spec.rb | # frozen_string_literal: true
require 'rom/command'
require 'rom/plugins/command/timestamps'
RSpec.describe ROM::Plugins::Command::Timestamps do
include_context 'container'
let(:users) { container.commands.users }
let(:tasks) { container.commands.tasks }
let(:time) { DateTime.now }
before do
configura... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/plugins/schema/timestamps_spec.rb | core/spec/unit/rom/plugins/schema/timestamps_spec.rb | # frozen_string_literal: true
RSpec.describe ROM::Plugins::Schema::Timestamps do
let(:relation) { ROM::Relation::Name[:users] }
let(:schema_dsl) do
ROM::Schema::DSL.new(relation)
end
subject(:schema) { schema_dsl.call }
it 'adds timestamp attributes' do
ts_attribute = lambda do |name|
ROM::A... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/plugins/relation/instrumentation_spec.rb | core/spec/unit/rom/plugins/relation/instrumentation_spec.rb | # frozen_string_literal: true
require 'rom/core'
require 'rom/memory'
RSpec.describe ROM::Plugins::Relation::Instrumentation do
before do
described_class.mixin Module.new
end
subject(:relation) do
relation_class.new(dataset, notifications: notifications)
end
let(:dataset) do
double(:dataset)
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/setup/auto_registration_spec.rb | core/spec/unit/rom/setup/auto_registration_spec.rb | # frozen_string_literal: true
require 'rom/setup'
require 'rom/support/notifications'
RSpec.describe ROM::Setup, '#auto_registration' do
let!(:loaded_features) { $LOADED_FEATURES.dup }
subject(:setup) { ROM::Setup.new(notifications) }
let(:notifications) { instance_double(ROM::Notifications::EventBus) }
af... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/mapper/model_dsl_spec.rb | core/spec/unit/rom/mapper/model_dsl_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ROM::Mapper::ModelDSL do
describe '#model' do
it 'calls the builder with non-excluded attributes only' do
definition_class = Class.new do
include ROM::Mapper::ModelDSL
def initialize
@attributes = [[:name], [:tit... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/mapper/dsl_spec.rb | core/spec/unit/rom/mapper/dsl_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ROM::Mapper do
subject(:mapper) do
klass = Class.new(parent)
options.each do |k, v|
klass.send(k, v)
end
klass
end
let(:parent) { Class.new(ROM::Mapper) }
let(:options) { {} }
let(:header) { mapper.header }
let(:ex... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema/finalize_spec.rb | core/spec/unit/rom/schema/finalize_spec.rb | # frozen_string_literal: true
require 'rom/schema'
RSpec.describe ROM::Schema, '#finalize!' do
context 'without inferrer' do
subject(:schema) do
define_schema(:users, id: :Integer, name: :String)
end
before { schema.finalize_attributes!.finalize! }
it 'returns a frozen canonical schema' do
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema/project_spec.rb | core/spec/unit/rom/schema/project_spec.rb | # frozen_string_literal: true
require 'rom/schema'
RSpec.describe ROM::Schema, '#project' do
subject(:schema) do
define_schema(:users, id: :Integer, name: :String, age: :Integer)
end
it 'projects provided attribute names' do
expect(schema.project(:name, :age).map(&:name)).to eql(%i[name age])
end
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema/canonical_spec.rb | core/spec/unit/rom/schema/canonical_spec.rb | # frozen_string_literal: true
require 'rom/schema'
RSpec.describe ROM::Schema, '#canonical' do
subject(:schema) {
define_schema(:users, id: :Integer, name: :String)
}
it 'returns self by default' do
expect(schema.canonical).to be(schema)
end
it 'returns canonical schema from a projected schema' do... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema/key_predicate_spec.rb | core/spec/unit/rom/schema/key_predicate_spec.rb | # frozen_string_literal: true
require 'rom/schema'
RSpec.describe ROM::Schema, '#key?' do
subject(:schema) do
define_schema(:users, name: :String)
end
it 'returns true when an attribute exists' do
expect(schema.key?(:name)).to be(true)
end
it 'returns false when an attribute does not exist' do
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema/prefix_spec.rb | core/spec/unit/rom/schema/prefix_spec.rb | # frozen_string_literal: true
require 'rom/schema'
RSpec.describe ROM::Schema, '#prefix' do
subject(:schema) do
define_schema(:users, id: :Integer, name: :String)
end
let(:prefixed) do
schema.prefix(:user)
end
it 'returns projected schema with renamed attributes using provided prefix' do
expec... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema/attribute_spec.rb | core/spec/unit/rom/schema/attribute_spec.rb | # frozen_string_literal: true
require 'rom/attribute'
RSpec.describe ROM::Attribute do
describe '#inspect' do
context 'with a primitive definition' do
subject(:attr) do
ROM::Attribute.new(ROM::Types::Integer, name: :id).meta(primary_key: true)
end
specify do
expect(
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema/uniq_spec.rb | core/spec/unit/rom/schema/uniq_spec.rb | # frozen_string_literal: true
require 'rom/schema'
RSpec.describe ROM::Schema, '#uniq' do
subject(:schema) { left.merge(right) }
let(:left) do
define_schema(:users, id: :Integer, name: :String)
end
let(:right) do
define_schema(:tasks, id: :Integer, user_id: :Integer)
end
it 'returns a new schem... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema/associations_dsl_spec.rb | core/spec/unit/rom/schema/associations_dsl_spec.rb | # frozen_string_literal: true
require 'rom/schema/associations_dsl'
RSpec.describe ROM::Schema::AssociationsDSL do
subject(:dsl) do
ROM::Schema::AssociationsDSL.new(ROM::Relation::Name[:users]) do
has_many :posts
end
end
describe '#call' do
it 'returns a configured association set' do
a... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema/wrap_spec.rb | core/spec/unit/rom/schema/wrap_spec.rb | # frozen_string_literal: true
require 'rom/schema'
RSpec.describe ROM::Schema, '#wrap' do
subject(:schema) do
define_schema(:users, id: :Integer, name: :String)
end
let(:wrapped) do
schema.wrap(:users)
end
it 'returns projected schema with renamed attributes using provided prefix' do
expect(wr... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema/rename_spec.rb | core/spec/unit/rom/schema/rename_spec.rb | # frozen_string_literal: true
require 'rom/schema'
RSpec.describe ROM::Schema, '#rename' do
subject(:schema) do
define_schema(
:users,
user_id: :Integer, user_name: :String, user_email: :String
)
end
let(:renamed) do
schema.rename(user_id: :id, user_name: :name)
end
it 'returns pro... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema/append_spec.rb | core/spec/unit/rom/schema/append_spec.rb | # frozen_string_literal: true
require 'rom/schema'
RSpec.describe ROM::Schema, '#append' do
subject(:schema) { left.append(*right) }
let(:left) do
define_schema(:users, id: :Integer, name: :String)
end
let(:right) do
define_schema(:tasks, user_id: :Integer)
end
it 'returns a new schema with att... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema/merge_spec.rb | core/spec/unit/rom/schema/merge_spec.rb | # frozen_string_literal: true
require 'rom/schema'
RSpec.describe ROM::Schema, '#merge' do
subject(:schema) { left.merge(right) }
let(:left) do
define_schema(:users, id: :Integer, name: :String)
end
let(:right) do
define_schema(:tasks, user_id: :Integer)
end
it 'returns a new schema with attrib... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema/exclude_spec.rb | core/spec/unit/rom/schema/exclude_spec.rb | # frozen_string_literal: true
require 'rom/schema'
RSpec.describe ROM::Schema, '#exclude' do
subject(:schema) do
define_schema(:users, id: :Integer, name: :String, email: :String)
end
let(:excluded) do
schema.exclude(:id, :name)
end
it 'returns projected schema with renamed attributes using provid... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/schema/accessing_attributes_spec.rb | core/spec/unit/rom/schema/accessing_attributes_spec.rb | # frozen_string_literal: true
require 'rom/schema'
RSpec.describe ROM::Schema, '#[]' do
context 'with a schema' do
subject(:schema) do
define_schema(:users, id: :Integer, name: :String, email: :String)
end
it 'returns an attribute identified by its canonical name' do
expect(schema[:email]).... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/associations/many_to_one_spec.rb | core/spec/unit/rom/associations/many_to_one_spec.rb | # frozen_string_literal: true
require 'rom/associations/many_to_one'
RSpec.describe ROM::Associations::ManyToOne do
subject(:assoc) do
build_assoc(:many_to_one, :users, :groups, **options, as: :group)
end
let(:options) { {} }
let(:relations) do
{ users: users, groups: groups }
end
let(:users) d... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/associations/one_to_many_spec.rb | core/spec/unit/rom/associations/one_to_many_spec.rb | # frozen_string_literal: true
require 'rom/associations/one_to_many'
RSpec.describe ROM::Associations::OneToMany do
subject(:assoc) do
build_assoc(:one_to_many, :groups, :users, **options, as: :users)
end
let(:options) { {} }
let(:relations) do
{ users: users, groups: groups }
end
let(:users) d... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/attribute/method_missing_spec.rb | core/spec/unit/rom/attribute/method_missing_spec.rb | # frozen_string_literal: true
require 'rom/types'
require 'rom/attribute'
RSpec.describe ROM::Attribute, '#method_missing' do
subject(:attribute) do
ROM::Attribute.new(type, name: :foo)
end
context 'with a plain definition' do
let(:type) do
ROM::Types::Integer
end
it 'forwards to its typ... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/attribute/to_ast_spec.rb | core/spec/unit/rom/attribute/to_ast_spec.rb | # frozen_string_literal: true
require 'rom/types'
require 'rom/attribute'
RSpec.describe ROM::Attribute, '#to_ast' do
subject(:attribute) { ROM::Attribute.new(ROM::Types::Integer, name: :id) }
types = [
ROM::Types::Integer,
ROM::Types::Strict::Integer,
ROM::Types::Strict::Integer.optional
]
to_a... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/attribute/optional_spec.rb | core/spec/unit/rom/attribute/optional_spec.rb | # frozen_string_literal: true
require 'rom/types'
require 'rom/attribute'
RSpec.describe ROM::Attribute, '#optional' do
subject(:attribute) do
ROM::Attribute.new(ROM::Types::Integer, name: :id).meta(read: ROM::Types::Coercible::Integer)
end
it 'transforms read type' do
expect(attribute.optional.to_read... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/relation/preload_assoc_spec.rb | core/spec/unit/rom/relation/preload_assoc_spec.rb | # frozen_string_literal: true
require 'rom/relation'
RSpec.describe ROM::Relation, '#preload_assoc' do
subject(:users) do
ROM::Relation.new([], name: ROM::Relation::Name[:users])
end
let(:tasks) do
ROM::Relation.new([], name: ROM::Relation::Name[:tasks])
end
let(:assoc) do
double(:assoc)
end... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/relation/new_spec.rb | core/spec/unit/rom/relation/new_spec.rb | # frozen_string_literal: true
require 'rom/relation'
RSpec.describe ROM::Relation, '#new' do
subject(:relation) do
Class.new(ROM::Relation) do
schema(:users) do
attribute :id, ROM::Types::String, read: ROM::Types::Coercible::Integer
attribute :name, ROM::Types::String
end
end.new... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/relation/foreign_key_spec.rb | core/spec/unit/rom/relation/foreign_key_spec.rb | # frozen_string_literal: true
require 'rom/relation'
RSpec.describe ROM::Relation, '#foreign_key' do
subject(:relation) do
Class.new(ROM::Relation) do
schema(:users) do
attribute :id, ROM::Types::Integer
attribute :group_id, ROM::Types::Integer.meta(foreign_key: true, target: :groups)
... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/relation/inspect_spec.rb | core/spec/unit/rom/relation/inspect_spec.rb | # frozen_string_literal: true
require 'rom/relation'
RSpec.describe ROM::Memory::Relation, '#inspect' do
subject(:relation) do
Class.new(ROM::Relation[:memory]) do
def self.name
'Users'
end
end.new([], name: ROM::Relation::Name[:users])
end
specify do
expect(relation.inspect).to... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/relation/to_ast_spec.rb | core/spec/unit/rom/relation/to_ast_spec.rb | # frozen_string_literal: true
require 'rom/relation'
RSpec.describe ROM::Relation, '#to_ast' do
let(:user_relation) do
Class.new(ROM::Relation[:memory]) do
schema(:users) do
attribute :id, ROM::Types::Integer
attribute :name, ROM::Types::String
end
def self.name
'Users... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/relation/eager_load_spec.rb | core/spec/unit/rom/relation/eager_load_spec.rb | # frozen_string_literal: true
require 'rom/relation'
RSpec.describe ROM::Relation, '#eager_load' do
let(:users) do
ROM::Relation.new([], name: ROM::Relation::Name[:users])
end
let(:tasks) do
ROM::Relation.new([], name: ROM::Relation::Name[:tasks])
end
let(:users_assocs_set) do
{ tasks: tasks_as... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/relation/map_with_spec.rb | core/spec/unit/rom/relation/map_with_spec.rb | # frozen_string_literal: true
require 'rom/relation'
RSpec.describe ROM::Relation, '#map_with' do
subject(:relation) do
ROM::Relation.new(
dataset,
name: ROM::Relation::Name[:users],
schema: schema,
mappers: mapper_registry
)
end
let(:mapper_registry) { ROM::MapperRegistry.build... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/relation/schema_spec.rb | core/spec/unit/rom/relation/schema_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rom/memory'
RSpec.describe ROM::Relation, '.schema' do
it 'defines a canonical schema for a relation' do
class Test::Users < ROM::Relation[:memory]
schema do
attribute :id, Types::Integer.meta(primary_key: true)
attribute :name, ... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/relation/combine_spec.rb | core/spec/unit/rom/relation/combine_spec.rb | # frozen_string_literal: true
require 'rom/relation'
RSpec.describe ROM::Relation, '#combine' do
let(:users) do
ROM::Relation.new([], name: ROM::Relation::Name[:users])
end
let(:tasks) do
ROM::Relation.new([], name: ROM::Relation::Name[:tasks])
end
let(:tags) do
ROM::Relation.new([], name: ROM... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/relation/curried_spec.rb | core/spec/unit/rom/relation/curried_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ROM::Relation::Curried do
include_context 'gateway only'
include_context 'users and tasks'
let(:users_relation) do
Class.new(ROM::Memory::Relation) do
def by_name(name)
restrict(name: name)
end
def by_names(*names... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/relation/map_to_spec.rb | core/spec/unit/rom/relation/map_to_spec.rb | # frozen_string_literal: true
require 'ostruct'
require 'rom/relation'
RSpec.describe ROM::Relation, '#map_to' do
subject(:relation) do
ROM::Relation.new(
dataset,
name: ROM::Relation::Name[:users],
schema: ROM::Relation.default_schema,
mappers: mapper_registry
)
end
let(:mapper... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/relation/as_spec.rb | core/spec/unit/rom/relation/as_spec.rb | # frozen_string_literal: true
require 'rom/relation'
RSpec.describe ROM::Relation, '#map_to' do
subject(:relation) do
ROM::Relation.new([], name: ROM::Relation::Name[:users])
end
it 'returns a new relation with an aliased name' do
expect(relation.as(:people).name).to eql(ROM::Relation::Name[:users].as(... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
rom-rb/rom | https://github.com/rom-rb/rom/blob/ac5d6618f36b0c48525fa48b7f6c774e0d1d2860/core/spec/unit/rom/relation/output_schema_spec.rb | core/spec/unit/rom/relation/output_schema_spec.rb | # frozen_string_literal: true
require 'rom/memory'
RSpec.describe ROM::Relation, '#output_schema' do
subject(:relation) do
Class.new(ROM::Relation[:memory]) do
schema do
attribute :id, ROM::Types::String, read: ROM::Types::Integer
attribute :name, ROM::Types::String
end
end.new(R... | ruby | MIT | ac5d6618f36b0c48525fa48b7f6c774e0d1d2860 | 2026-01-04T15:58:11.374901Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.