zdennis (owner)

Fork Of

Revisions

gist: 85828 Download_button fork
public
Public Clone URL: git://gist.github.com/85828.git
Embed All Files: show embed
adapter_spec.rb #
1
2
3
4
describe MyCustomerAdapter do
  should_support_adapter_interface :create
  should_support_adapter_interface :delete
end
macro.rb #
1
2
3
4
5
6
7
8
9
10
11
12
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_helper.rb #
1
2
3
Spec::Runner.configure do |config|
  config.extend SpecHelpers::AdapterMethods
end