Skip to content

Commit

Permalink
Fix schema name verification #615 (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
ippachi authored Jun 1, 2021
1 parent 8e07d73 commit 5eb82b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rom/relation/class_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module ClassInterface

DEFAULT_DATASET_PROC = -> * { self }.freeze
INVALID_RELATIONS_NAMES = [
:relations
:relations, :schema
].freeze

# Return adapter-specific relation subclass
Expand Down
14 changes: 14 additions & 0 deletions spec/unit/rom/relation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ class Relations < ROM::Relation[:memory]
end
end

let(:relation_name_schema) do
module Test
class Relations < ROM::Relation[:memory]
schema(:schema) {}
end
end
end

it "raises an exception when is symbol" do
expect {
relation_name_symbol
Expand All @@ -143,6 +151,12 @@ class Relations < ROM::Relation[:memory]
relation_name_string
}.to raise_error(ROM::InvalidRelationName)
end

it "raises an exception when schema name is schema" do
expect {
relation_name_schema
}.to raise_error(ROM::InvalidRelationName)
end
end
end

Expand Down

0 comments on commit 5eb82b7

Please sign in to comment.