Sha256: 3112bf9d01b5b2679f9cc865c2777baa6099b7ed15fbf0718949d8a7c04fb3ea
Contents?: true
Size: 1.11 KB
Versions: 76
Compression:
Stored size: 1.11 KB
Contents
require "test_helper" class CuratedListTest < ActiveSupport::TestCase test "should validate format of slug" do cl = CuratedList.new(slug: 'I am not a valid slug') assert !cl.valid? assert cl.errors[:slug].any?, "Doesn't have error on slug" end test "should include ability to have a section tag" do cl = FactoryGirl.create(:curated_list) tag = FactoryGirl.create(:live_tag, tag_id: 'batman', title: 'Batman', tag_type: 'section') cl.sections = ['batman'] cl.save assert_equal [tag], cl.sections end test "should return artefacts in relationship order, not their natural order" do a = FactoryGirl.create(:artefact, name: "A") b = FactoryGirl.create(:artefact, name: "B") cl = FactoryGirl.create(:curated_list, artefact_ids: [b._id, a._id]) assert_equal ["B", "A"], cl.artefacts.map(&:name) end test "should translate string IDs to BSON::ObjectIds for artefacts set via artefact_ids" do a = FactoryGirl.create(:artefact, name: "A") cl = FactoryGirl.create(:curated_list, artefact_ids: [a.id.to_s]) assert cl.artefact_ids.first.is_a?(BSON::ObjectId) end end
Version data entries
76 entries across 76 versions & 1 rubygems