Skip to content

Commit

Permalink
Fixes identifier errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjy committed Dec 6, 2013
1 parent 0f6d350 commit caf211c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions app/models/identifier/guid.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
class Identifier::Guid < Identifier


validates :namespace_id, absence: true
end
2 changes: 2 additions & 0 deletions app/models/identifier/local_id.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
class Identifier::LocalId < Identifier
belongs_to :namespace
validates :namespace, presence: true
end
6 changes: 3 additions & 3 deletions spec/models/identifier/guid_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
end
end

specify 'namespace is nil' do
guid_identifier.namespace = FactoryGirl.build(:valid_namespace)
specify 'namespace_id is nil' do
guid_identifier.namespace_id = FactoryGirl.create(:valid_namespace).id
guid_identifier.valid?
expect(guid_identifier.errors.include?(:namespace)).to be_true
expect(guid_identifier.errors.include?(:namespace_id)).to be_true
end

end

0 comments on commit caf211c

Please sign in to comment.