Sha256: 29e766eb5e124ff11ac65ba7bb1cfd18bbc63c3e77806c487ac2ddf9caed93d6

Contents?: true

Size: 1.49 KB

Versions: 37

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'

# rubocop:disable RSpec/InstanceVariable # TODO: Explore if there is a way to remove this disable
describe Qa::SubjectMeshTerm, type: :model do
  before(:all) do
    @term = Qa::SubjectMeshTerm.new
    @term.term_id = "ABCDEFG"
    @term.term = "Glyphon"
    @term.save!
  end
  after(:all) do
    @term.destroy
  end
  it "returns an empty synonym list" do
    expect(@term.synonyms).to eq([])
  end
  it "returns a list of trees" do
    expect(@term.trees).to eq([])
  end
  it "saves a synonym list" do
    a = Qa::SubjectMeshTerm.new
    a.term_id = 'a'
    a.synonyms = ['b', 'c']
    a.save
    expect(a.synonyms).to eq(['b', 'c'])
  end
  it "finds a term by tree number" do
    t = Qa::MeshTree.new
    t.term_id = @term.term_id
    t.tree_number = "D1.2.3.4"
    t.save!
    a = Qa::SubjectMeshTerm.from_tree_number("D1.2.3.4")
    expect(a.length).to eq(1)
  end

  it "returns parents"
  # do
  #  SubjectMeshTerm.create(term_id: "1")
  #  SubjectMeshTerm.create(term_id: "2")
  #  SubjectMeshTerm.create(term_id: "3")
  #  MeshTree.create(term_id: @term.term_id, tree_number: "D1.2.3")
  #  MeshTree.create(term_id: @term.term_id, tree_number: "D1.A.3")
  #  MeshTree.create(term_id: '2', tree_number: "D1.2")
  #  MeshTree.create(term_id: '3', tree_number: "D1.A")
  #  MeshTree.create(term_id: '1', tree_number: "D1")

  #  @term.trees.should == ["D1.2.3", "D1.A.3"]
  #  @term.parents.map { |p| p.term_id }.should == ["1", "2", "3"]
  # end
end
# rubocop:enable RSpec/InstanceVariable

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
qa-5.14.0 spec/models/subject_mesh_term_spec.rb
qa-5.13.0 spec/models/subject_mesh_term_spec.rb
qa-5.12.0 spec/models/subject_mesh_term_spec.rb
qa-5.11.0 spec/models/subject_mesh_term_spec.rb
qa-5.10.0 spec/models/subject_mesh_term_spec.rb
qa-5.9.0 spec/models/subject_mesh_term_spec.rb
qa-5.8.1 spec/models/subject_mesh_term_spec.rb
qa-5.8.0 spec/models/subject_mesh_term_spec.rb
qa-5.7.0 spec/models/subject_mesh_term_spec.rb
qa-5.6.0 spec/models/subject_mesh_term_spec.rb
qa-5.5.2 spec/models/subject_mesh_term_spec.rb
qa-4.3.0 spec/models/subject_mesh_term_spec.rb
qa-3.1.0 spec/models/subject_mesh_term_spec.rb
qa-2.3.0 spec/models/subject_mesh_term_spec.rb
qa-5.5.1 spec/models/subject_mesh_term_spec.rb
qa-5.5.0 spec/models/subject_mesh_term_spec.rb
qa-5.4.0 spec/models/subject_mesh_term_spec.rb
qa-5.3.1 spec/models/subject_mesh_term_spec.rb
qa-5.3.0 spec/models/subject_mesh_term_spec.rb
qa-5.2.0 spec/models/subject_mesh_term_spec.rb