Sha256: a966e49056dd0f081b4bf2981964ca0e9d2895971c1c0105cfb5060c457ec342

Contents?: true

Size: 1010 Bytes

Versions: 45

Compression:

Stored size: 1010 Bytes

Contents

RSpec::Matchers.define :map_specs do |specs|
  match do |autotest|
    @specs = specs
    @autotest = prepare(autotest)
    autotest.test_files_for(@file) == specs
  end

  chain :to do |file|
    @file = file
  end

  failure_message_for_should do
    "expected #{@autotest.class} to map #{@specs.inspect} to #{@file.inspect}\ngot #{@actual.inspect}"
  end

  def prepare(autotest)
    find_order = @specs.dup << @file
    autotest.instance_eval { @find_order = find_order }
    autotest
  end
end

RSpec::Matchers.define :have_interface_for do |method|
  match do |object|
    @method = method
    @object = object
    object.respond_to?(method) && actual_arity == @expected_arity
  end

  chain :with do |arity|
    @expected_arity = arity
  end

  chain(:argument) {}
  chain(:arguments) {}

  failure_message_for_should do
    "#{@object} should have method :#{@method} with #{@expected_arity} argument(s), but it had #{actual_arity}"
  end

  def actual_arity
    @object.method(@method).arity
  end
end

Version data entries

45 entries across 45 versions & 4 rubygems

Version Path
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/rspec-core-2.5.1/spec/support/matchers.rb
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/rspec-core-2.5.1/spec/support/matchers.rb
rspec-core-2.5.2 spec/support/matchers.rb
rspec-core-2.5.1 spec/support/matchers.rb
rspec-core-2.5.0 spec/support/matchers.rb
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/rspec-core-2.1.0/spec/support/matchers.rb
rspec-core-2.4.0 spec/support/matchers.rb
vim-jar-0.1.2 bundler/ruby/1.8/gems/rspec-core-2.1.0/spec/support/matchers.rb
vim-jar-0.1.1 bundler/ruby/1.8/gems/rspec-core-2.1.0/spec/support/matchers.rb
vim-jar-0.1.0 bundler/ruby/1.8/gems/rspec-core-2.1.0/spec/support/matchers.rb
rspec-core-2.3.1 spec/support/matchers.rb
rspec-core-2.3.0 spec/support/matchers.rb
vim-jar-0.0.3 bundler/ruby/1.8/gems/rspec-core-2.1.0/spec/support/matchers.rb
rspec-core-2.2.1 spec/support/matchers.rb
vim-jar-0.0.2 bundler/ruby/1.8/gems/rspec-core-2.1.0/spec/support/matchers.rb
vim-jar-0.0.1 bundler/ruby/1.8/gems/rspec-core-2.1.0/spec/support/matchers.rb
rspec-core-2.2.0 spec/support/matchers.rb
rspec-core-2.1.0 spec/support/matchers.rb
rspec-core-2.0.1 spec/support/matchers.rb
gemrage-1.0.0 vendor/ruby/1.8/gems/rspec-core-2.0.0/spec/support/matchers.rb