Created
April 25, 2014 17:20
-
-
Save jeremyf/11296882 to your computer and use it in GitHub Desktop.
Spitballing some spec_support for mixed in behaviors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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