Sha256: 2e4a2d08d83dff873c1d11e44c6e5786f2bb11455e1fbfd67996ba78ea9e2f0a

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper.rb'

Spec::Matchers.define :have_public_instance_method do |method|
  match do |klass|
    klass.public_instance_methods.include?(method)
  end
end

module Spec
  module Matchers
    describe Spec::Matchers do
      (Spec::Matchers.constants.sort).each do |c|
        if (Class === (klass = Spec::Matchers.const_get(c)))
          describe klass do
            if klass.public_instance_methods.include?('failure_message_for_should')
              describe "called with should" do
                subject { klass }
                it { should have_public_instance_method('failure_message_for_should')}
                it { should have_public_instance_method('failure_message')}
              end
            end
            if klass.public_instance_methods.include?('failure_message_for_should_not')
              describe "called with should not" do
                subject { klass }
                it { should have_public_instance_method('failure_message_for_should_not')}
                it { should have_public_instance_method('negative_failure_message')}
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-1.2.3 spec/spec/matchers/compatibility_spec.rb
rspec-1.2.4 spec/spec/matchers/compatibility_spec.rb