Skip to content

Commit

Permalink
Adapt test suite to attr alias being an option
Browse files Browse the repository at this point in the history
  • Loading branch information
waiting-for-dev committed Apr 28, 2019
1 parent e4ae2da commit d480b5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/spec/unit/rom/plugins/command/alias_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
before do
configuration.relation :users do
schema(:users) do
attribute :first_name, Types::String.meta(alias: :name)
attribute :first_name, Types::String, alias: :name
end
end

Expand Down
7 changes: 5 additions & 2 deletions core/spec/unit/rom/schema_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@

describe '#alias_mapping' do
it 'returns a hash from canonical name to alias including aliased attributes' do
attrs = { id: ROM::Types::Integer.meta(name: :id, alias: :pk), name: ROM::Types::String }
schema = ROM::Schema.define(:name, attributes: attrs.values)
attrs = [
define_attr_info(:Integer, name: :id, alias: :pk),
define_attr_info(:String, name: :name)
]
schema = ROM::Schema.define(:name, attributes: attrs)

expect(schema.alias_mapping).to eq(id: :pk)
end
Expand Down

0 comments on commit d480b5c

Please sign in to comment.