Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Commit

Permalink
Update error message to provide better feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dkubb committed Jun 18, 2013
1 parent 396211c commit 44dd39a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/dm-core/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ def assert_valid_properties
repository_name = self.repository_name
if properties(repository_name).empty? &&
!relationships(repository_name).any? { |relationship| relationship.kind_of?(Associations::ManyToOne::Relationship) }
raise IncompleteModelError, "#{name} must have at least one property or many to one relationship to be valid"
raise IncompleteModelError, "#{name} must have at least one property or many to one relationship in #{repository_name} to be valid"
end
end

Expand All @@ -862,7 +862,7 @@ def assert_valid_properties
# @api private
def assert_valid_key
if key(repository_name).empty?
raise IncompleteModelError, "#{name} must have a key to be valid"
raise IncompleteModelError, "#{name} must have a key in #{repository_name} to be valid"
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/public/finalize_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ::EmptyObject
include DataMapper::Resource
end
begin
method(:subject).should raise_error(DataMapper::IncompleteModelError, 'EmptyObject must have at least one property or many to one relationship to be valid')
method(:subject).should raise_error(DataMapper::IncompleteModelError, 'EmptyObject must have at least one property or many to one relationship in default to be valid')
ensure
DataMapper::Model.descendants.delete(EmptyObject)
Object.send(:remove_const, :EmptyObject)
Expand All @@ -66,7 +66,7 @@ class ::KeylessObject
property :name, String
end
begin
method(:subject).should raise_error(DataMapper::IncompleteModelError, 'KeylessObject must have a key to be valid')
method(:subject).should raise_error(DataMapper::IncompleteModelError, 'KeylessObject must have a key in default to be valid')
ensure
DataMapper::Model.descendants.delete(KeylessObject)
Object.send(:remove_const, :KeylessObject)
Expand Down

0 comments on commit 44dd39a

Please sign in to comment.