Skip to content

Commit d2809e8

Browse files
committed
wip
1 parent b0c0a53 commit d2809e8

File tree

4 files changed

+71
-71
lines changed

4 files changed

+71
-71
lines changed

spec/integration/rom/factory_spec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,18 @@
165165
end
166166

167167
conf.relation(:basic_users) do
168-
schema(infer: true) do
169-
associations do
170-
has_one :basic_account
171-
end
168+
schema(infer: true)
169+
170+
associations do
171+
has_one :basic_account
172172
end
173173
end
174174

175175
conf.relation(:basic_accounts) do
176-
schema(infer: true) do
177-
associations do
178-
belongs_to :basic_user
179-
end
176+
schema(infer: true)
177+
178+
associations do
179+
belongs_to :basic_user
180180
end
181181
end
182182
end
@@ -1194,10 +1194,10 @@ class User < ROM::Struct
11941194
attribute :title, ROM::SQL::Types::String.meta(
11951195
read: ROM::SQL::Types::String.constructor(&:upcase)
11961196
)
1197+
end
11971198

1198-
associations do
1199-
belongs_to :user
1200-
end
1199+
associations do
1200+
belongs_to :user
12011201
end
12021202
end
12031203
end

spec/shared/database.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
end
1313

1414
let(:conn) do
15-
rom.gateways[:default].connection
15+
conf.registry.gateways[:default].connection
1616
end
1717

1818
let(:relations) do

spec/shared/relations.rb

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# frozen_string_literal: true
22

3+
require 'rom/compat'
4+
35
RSpec.shared_context 'relations' do
46
include_context 'database'
57

@@ -39,48 +41,48 @@
3941
end
4042

4143
conf.relation(:tasks) do
42-
schema(infer: true) do
43-
associations do
44-
belongs_to :user
45-
end
44+
schema(infer: true)
45+
46+
associations do
47+
belongs_to :user
4648
end
4749
end
4850

4951
conf.relation(:users) do
50-
schema(infer: true) do
51-
associations do
52-
has_many :tasks
53-
has_one :user_addresses
54-
has_one :address, through: :user_addresses
55-
end
52+
schema(infer: true)
53+
54+
associations do
55+
has_many :tasks
56+
has_one :user_addresses
57+
has_one :address, through: :user_addresses
5658
end
5759
end
5860

5961
conf.relation(:addresses) do
60-
schema(infer: true) do
61-
associations do
62-
has_one :user_addresses
63-
has_one :user, through: :user_addresses
64-
end
62+
schema(infer: true)
63+
64+
associations do
65+
has_one :user_addresses
66+
has_one :user, through: :user_addresses
6567
end
6668
end
6769

6870
conf.relation(:user_addresses) do
69-
schema(infer: true) do
70-
associations do
71-
belongs_to :user
72-
belongs_to :address
73-
end
71+
schema(infer: true)
72+
73+
associations do
74+
belongs_to :user
75+
belongs_to :address
7476
end
7577
end
7678

7779
conf.relation(:admins) do
7880
dataset { where(type: "Admin") }
7981

80-
schema(:users, as: :admins, infer: true) do
81-
associations do
82-
has_many :tasks
83-
end
82+
schema(:users, as: :admins, infer: true)
83+
84+
associations do
85+
has_many :tasks
8486
end
8587
end
8688

spec/unit/rom/factory/builder_spec.rb

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
require 'rom/factory/builder'
4-
53
RSpec.describe ROM::Factory::Builder do
64
subject(:builder) do
75
ROM::Factory::Builder.new(ROM::Factory::AttributeRegistry.new(attributes),
@@ -72,10 +70,10 @@
7270
end
7371

7472
conf.relation(:tasks) do
75-
schema(infer: true) do
76-
associations do
77-
belongs_to :user
78-
end
73+
schema(infer: true)
74+
75+
associations do
76+
belongs_to :user
7977
end
8078
end
8179

@@ -155,27 +153,27 @@
155153
end
156154

157155
conf.relation(:users) do
158-
schema(infer: true) do
159-
associations do
160-
has_many :users, through: :users_tasks
161-
end
156+
schema(infer: true)
157+
158+
associations do
159+
has_many :users, through: :users_tasks
162160
end
163161
end
164162

165163
conf.relation(:tasks) do
166-
schema(infer: true) do
167-
associations do
168-
has_many :users, through: :users_tasks
169-
end
164+
schema(infer: true)
165+
166+
associations do
167+
has_many :users, through: :users_tasks
170168
end
171169
end
172170

173171
conf.relation(:users_tasks) do
174-
schema(infer: true) do
175-
associations do
176-
belongs_to :user
177-
belongs_to :task
178-
end
172+
schema(infer: true)
173+
174+
associations do
175+
belongs_to :user
176+
belongs_to :task
179177
end
180178
end
181179

@@ -227,18 +225,18 @@
227225
end
228226

229227
conf.relation(:tasks) do
230-
schema(infer: true) do
231-
associations do
232-
belongs_to :user
233-
end
228+
schema(infer: true)
229+
230+
associations do
231+
belongs_to :user
234232
end
235233
end
236234

237235
conf.relation(:users) do
238-
schema(infer: true) do
239-
associations do
240-
has_many :tasks
241-
end
236+
schema(infer: true)
237+
238+
associations do
239+
has_many :tasks
242240
end
243241
end
244242

@@ -293,18 +291,18 @@
293291
end
294292

295293
conf.relation(:tasks) do
296-
schema(infer: true) do
297-
associations do
298-
belongs_to :user
299-
end
294+
schema(infer: true)
295+
296+
associations do
297+
belongs_to :user
300298
end
301299
end
302300

303301
conf.relation(:users) do
304-
schema(infer: true) do
305-
associations do
306-
has_one :task
307-
end
302+
schema(infer: true)
303+
304+
associations do
305+
has_one :task
308306
end
309307
end
310308

0 commit comments

Comments
 (0)