Sha256: e33c0d0af999563bb9d858c85270a4ebea51f0ba38f70ec02808013a9cb2b78c

Contents?: true

Size: 1.06 KB

Versions: 16

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

Rspec::Matchers.define :have_public_instance_method do |method|
  match do |klass|
    klass.public_instance_methods.any? {|m| [method, method.to_sym].include?(m)}
  end
end

(Rspec::Matchers.constants.sort).each do |c|
  if (Class === (klass = Rspec::Matchers.const_get(c)))
    describe klass do
      if klass.public_instance_methods.any? {|m| ['failure_message_for_should',:failure_message_for_should].include?(m)}
        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.any? {|m| ['failure_message_for_should_not',:failure_message_for_should_not].include?(m)}
        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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rspec-expectations-2.0.0.beta.8 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.beta.7 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.beta.6 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.beta.5 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.beta.4 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.beta.3 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.beta.2 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.beta.1 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.a10 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.a9 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.a8 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.a7 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.a6 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.a5 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.a4 spec/rspec/matchers/compatibility_spec.rb
rspec-expectations-2.0.0.a3 spec/rspec/matchers/compatibility_spec.rb