test/models/concept_test.rb in iqvoc-4.7.0 vs test/models/concept_test.rb in iqvoc-4.8.0

- old
+ new

@@ -13,11 +13,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper') -require 'iqvoc/rdfapi' class ConceptTest < ActiveSupport::TestCase test 'blank concept' do c = Concept::Base.new assert c.valid? @@ -40,29 +39,29 @@ c2.save! end end test 'concept with no preflabel' do - concept = Iqvoc::RDFAPI.devour 'bear', 'a', 'skos:Concept' + concept = RDFAPI.devour 'bear', 'a', 'skos:Concept' assert concept.save refute concept.publishable? assert_raise ActiveRecord::RecordInvalid do concept.publish! end end test 'concepts without pref_labels should be saveable but not publishable' do - concept = Iqvoc::RDFAPI.devour 'bear', 'a', 'skos:Concept' + concept = RDFAPI.devour 'bear', 'a', 'skos:Concept' assert_equal [], concept.pref_labels assert concept.valid? refute concept.publishable? end test 'published concept must have a pref_label of the first pref_label language configured (the main language)' do - concept = Iqvoc::RDFAPI.devour 'bear', 'a', 'skos:Concept' - Iqvoc::RDFAPI.devour concept, 'skos:prefLabel', '"Bear"@en' + concept = RDFAPI.devour 'bear', 'a', 'skos:Concept' + RDFAPI.devour concept, 'skos:prefLabel', '"Bear"@en' assert concept.save assert_equal 1, concept.pref_labels.count @@ -72,40 +71,40 @@ assert !concept.publishable? end test 'one pref label per language' do concept = Concept::SKOS::Base.new.tap do |c| - Iqvoc::RDFAPI.devour c, 'skos:prefLabel', '"Bear"@en' + RDFAPI.devour c, 'skos:prefLabel', '"Bear"@en' c.publish c.save end assert concept.valid? - Iqvoc::RDFAPI.devour concept, 'skos:prefLabel', '"Beaaar"@en' + RDFAPI.devour concept, 'skos:prefLabel', '"Beaaar"@en' concept.pref_labelings.reload assert_equal 2, concept.pref_labelings.count assert_equal concept.pref_labelings.first.target.language, concept.pref_labelings.second.target.language assert concept.invalid? end test 'unique pref label' do - bear_one = Iqvoc::RDFAPI.devour 'bear_one', 'a', 'skos:Concept' - Iqvoc::RDFAPI.devour bear_one, 'skos:prefLabel', '"Bear"@en' + bear_one = RDFAPI.devour 'bear_one', 'a', 'skos:Concept' + RDFAPI.devour bear_one, 'skos:prefLabel', '"Bear"@en' assert bear_one.save assert bear_one.publishable? - bear_two = Iqvoc::RDFAPI.devour 'bear_two', 'a', 'skos:Concept' - Iqvoc::RDFAPI.devour bear_two, 'skos:prefLabel', '"Bear"@en' + bear_two = RDFAPI.devour 'bear_two', 'a', 'skos:Concept' + RDFAPI.devour bear_two, 'skos:prefLabel', '"Bear"@en' bear_two.save! refute bear_two.publishable? end test 'multiple pref labels' do - concept = Iqvoc::RDFAPI.devour 'bear', 'a', 'skos:Concept' - Iqvoc::RDFAPI.devour concept, 'skos:prefLabel', '"Bear"@en' - Iqvoc::RDFAPI.devour concept, 'skos:prefLabel', '"Bär"@de' + concept = RDFAPI.devour 'bear', 'a', 'skos:Concept' + RDFAPI.devour concept, 'skos:prefLabel', '"Bear"@en' + RDFAPI.devour concept, 'skos:prefLabel', '"Bär"@de' assert concept.save concept.reload assert_equal 2, concept.pref_labels.count