Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Spitballing some spec_support for mixed in behaviors
# a-gem/lib/hydra_permlink/spec_support.rb
require 'rspec'
shared_examples 'a permalinked object' do |options|
let(:model) { described_class.new }
included_services = options.fetch(:services)
if included_services.include?(:doi)
it 'should permalink to a DOI'
end
if included_services.include?(:ark)
it 'should permalink to an ARK'
end
end
# my-app/spec/models/my_model_spec.rb
describe MyModel do
it_behaves_like 'a permalinked object', services: [:doi, :ark]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.