Skip to content

Instantly share code, notes, and snippets.

@zdennis
Forked from paul/adapter_shared_spec.rb
Created March 26, 2009 02:25
Show Gist options
  • Save zdennis/85828 to your computer and use it in GitHub Desktop.
Save zdennis/85828 to your computer and use it in GitHub Desktop.
describe MyCustomerAdapter do
should_support_adapter_interface :create
should_support_adapter_interface :delete
end
module SpecHelpers
module AdapterMethods
def should_support_adapter_interface(interface)
if described_type.instance_methods.include?(interface.to_s)
# split out your interfaces in their own shared specs
it_should_behave_like "an adapter supporting the :#{interface} method"
else
it "needs to support the :#{interface} method"
end
end
end
end
Spec::Runner.configure do |config|
config.extend SpecHelpers::AdapterMethods
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment