Module: Krikri::Spec::Matchers
- Defined in:
- lib/krikri/spec/matchers.rb
Overview
Defines matchers for Krikri
ActiveTriples Matchers collapse
-
#be_exact_match_with ⇒ Object
Match on the ‘skos:exactMatch` relation.
-
#have_provided_label ⇒ Object
Match on the ‘dpla:providedLabel` relation.
Instance Method Details
#be_exact_match_with ⇒ Object
Match on the ‘skos:exactMatch` relation.
14 15 16 17 18 19 |
# File 'lib/krikri/spec/matchers.rb', line 14 RSpec::Matchers.define :be_exact_match_with do |expected| match do |actual| exact_match = RDF::URI('http://www.w3.org/2004/02/skos/core#exactMatch') !actual.first([actual, exact_match, expected]).nil? end end |
#have_provided_label ⇒ Object
Match on the ‘dpla:providedLabel` relation.
23 24 25 26 27 28 29 30 31 |
# File 'lib/krikri/spec/matchers.rb', line 23 RSpec::Matchers.define :have_provided_label do |expected| match do |actual| provided_label = RDF::URI('http://dp.la/about/map/providedLabel') pattern = [actual, provided_label, nil] expect(actual.query(pattern).map(&:object)).to include(expected) true end end |