-
-
Save zdennis/85828 to your computer and use it in GitHub Desktop.
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
describe MyCustomerAdapter do | |
should_support_adapter_interface :create | |
should_support_adapter_interface :delete | |
end |
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
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 |
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
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