Skip to content

Commit

Permalink
Spec
Browse files Browse the repository at this point in the history
  • Loading branch information
CGillen committed Feb 21, 2024
1 parent b5abadd commit ea28c8a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions spec/hyrax/controlled_vocabularies/location_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,28 @@
context 'with a valid label and subject' do
before do
allow(location).to receive(:rdf_label).and_return(['RDF_Label'])
allow(location).to receive(:rdf_subject).and_return('RDF.Subject.Org')
allow(location).to receive(:rdf_subject).and_return('http://RDF.Subject.Org')
end

it { expect(location.solrize).to eq ['RDF.Subject.Org', { label: 'RDF_Label$RDF.Subject.Org' }] }
it { expect(location.solrize).to eq ['https://RDF.Subject.Org', { label: 'RDF_Label$https://RDF.Subject.Org' }] }
end

context 'without a label' do
before do
allow(location).to receive(:rdf_label).and_return([''])
allow(location).to receive(:rdf_subject).and_return('RDF.Subject.Org')
allow(location).to receive(:rdf_subject).and_return('http://RDF.Subject.Org')
end

it { expect(location.solrize).to eq ['RDF.Subject.Org'] }
it { expect(location.solrize).to eq ['https://RDF.Subject.Org'] }
end

context 'when label and uri are the same' do
before do
allow(location).to receive(:rdf_label).and_return(['RDF.Subject.Org'])
allow(location).to receive(:rdf_subject).and_return('RDF.Subject.Org')
allow(location).to receive(:rdf_label).and_return(['http://RDF.Subject.Org'])
allow(location).to receive(:rdf_subject).and_return('http://RDF.Subject.Org')
end

it { expect(location.solrize).to eq ['RDF.Subject.Org'] }
it { expect(location.solrize).to eq ['https://RDF.Subject.Org'] }
end
end

Expand Down
14 changes: 7 additions & 7 deletions spec/oregon_digital/controlled_vocabularies/institution_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,28 @@
context 'with a valid label and subject' do
before do
allow(vocab_inst).to receive(:rdf_label).and_return([RDF::Literal.new('RDF_Label', language: I18n.locale)])
allow(vocab_inst).to receive(:rdf_subject).and_return('RDF.Subject.Org')
allow(vocab_inst).to receive(:rdf_subject).and_return('http://RDF.Subject.Org')
end

it { expect(vocab_inst.solrize).to eq ['RDF.Subject.Org', { label: 'RDF_Label$RDF.Subject.Org' }] }
it { expect(vocab_inst.solrize).to eq ['https://RDF.Subject.Org', { label: 'RDF_Label$https://RDF.Subject.Org' }] }
end

context 'without a label' do
before do
allow(vocab_inst).to receive(:rdf_label).and_return([])
allow(vocab_inst).to receive(:rdf_subject).and_return('RDF.Subject.Org')
allow(vocab_inst).to receive(:rdf_subject).and_return('http://RDF.Subject.Org')
end

it { expect(vocab_inst.solrize).to eq ['RDF.Subject.Org'] }
it { expect(vocab_inst.solrize).to eq ['https://RDF.Subject.Org'] }
end

context 'when label and uri are the same' do
before do
allow(vocab_inst).to receive(:rdf_label).and_return([RDF::Literal.new('RDF.Subject.Org', language: I18n.locale)])
allow(vocab_inst).to receive(:rdf_subject).and_return('RDF.Subject.Org')
allow(vocab_inst).to receive(:rdf_label).and_return([RDF::Literal.new('http://RDF.Subject.Org', language: I18n.locale)])
allow(vocab_inst).to receive(:rdf_subject).and_return('http://RDF.Subject.Org')
end

it { expect(vocab_inst.solrize).to eq ['RDF.Subject.Org'] }
it { expect(vocab_inst.solrize).to eq ['https://RDF.Subject.Org'] }
end
end
end
14 changes: 7 additions & 7 deletions spec/oregon_digital/controlled_vocabularies/resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@
context 'with a valid label and subject' do
before do
allow(resource).to receive(:rdf_label).and_return(['RDF_Label'])
allow(resource).to receive(:rdf_subject).and_return('RDF.Subject.Org')
allow(resource).to receive(:rdf_subject).and_return('http://RDF.Subject.Org')
end

it { expect(resource.solrize).to eq ['RDF.Subject.Org', { label: 'RDF_Label$RDF.Subject.Org' }] }
it { expect(resource.solrize).to eq ['https://RDF.Subject.Org', { label: 'RDF_Label$https://RDF.Subject.Org' }] }
end

context 'without a label' do
before do
allow(resource).to receive(:rdf_label).and_return([''])
allow(resource).to receive(:rdf_subject).and_return('RDF.Subject.Org')
allow(resource).to receive(:rdf_subject).and_return('http://RDF.Subject.Org')
end

it { expect(resource.solrize).to eq ['RDF.Subject.Org'] }
it { expect(resource.solrize).to eq ['https://RDF.Subject.Org'] }
end

context 'when label and uri are the same' do
before do
allow(resource).to receive(:rdf_label).and_return(['RDF.Subject.Org'])
allow(resource).to receive(:rdf_subject).and_return('RDF.Subject.Org')
allow(resource).to receive(:rdf_label).and_return(['http://RDF.Subject.Org'])
allow(resource).to receive(:rdf_subject).and_return('http://RDF.Subject.Org')
end

it { expect(resource.solrize).to eq ['RDF.Subject.Org'] }
it { expect(resource.solrize).to eq ['https://RDF.Subject.Org'] }
end
end

Expand Down

0 comments on commit ea28c8a

Please sign in to comment.