Skip to content

Commit

Permalink
Spec tests (failing) for community data vs. project_id.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjy committed Feb 5, 2015
1 parent a0ce22f commit 04be56a
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions spec/models/alternate_value_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@
alternate_value.valid?
expect(alternate_value.errors.include?(:value)).to be_truthy
end

specify 'can not add alternate values to NON_ANNOTATABLE_COLUMNS' do
skip
end

end

context 'scopes' do
Expand Down Expand Up @@ -107,6 +102,26 @@
v = FactoryGirl.build(:valid_alternate_value_abbreviation, value: 'foo', alternate_value_object_attribute: 'name', alternate_value_object: o )
expect(v.original_value).to eq(tmp) # see the serial_factory
end

specify 'project_id is not set for community data (Shared::SharedAcrossProjects)' do
o = FactoryGirl.build(:valid_serial, name: 'The Serial')
alternate_value.alternate_value_object = o
alternate_value.alternate_value_object_attribute = 'name'
alternate_value.value = 'T.S.'
alternate_value.type = 'AlternateValue::Abbreviation'
expect(alternate_value.valid?).to be(true)
expect(alternate_value.project_id).to eq(nil)
end

specify 'project_id is set for non community data' do
o = FactoryGirl.build(:valid_controlled_vocabulary_term)
alternate_value.alternate_value_object = o
alternate_value.alternate_value_object_attribute = 'name'
alternate_value.value = 'T.S.'
alternate_value.type = 'AlternateValue::Abbreviation'
expect(alternate_value.valid?).to be(true)
expect(alternate_value.project_id).to eq(1)
end
end

end

0 comments on commit 04be56a

Please sign in to comment.