Sha256: 10bedd755cc2f50487936f796f6efceca9977f6826834edf5e966c9b31ecd112

Contents?: true

Size: 715 Bytes

Versions: 5

Compression:

Stored size: 715 Bytes

Contents

require 'spec_helper'

module Rspec
  module Matchers
    module DSL
      describe "#define" do
        it "creates a method that initializes a new matcher with the submitted name and expected arg" do
          # FIXME - this expects new to be called, but we need something
          # more robust - that expects new to be called with a specific
          # block (lambda, proc, whatever)
          mod = Module.new
          mod.extend Rspec::Matchers::DSL
          mod.define(:foo)
    
          obj = Object.new
          obj.extend mod
    
          Rspec::Matchers::Matcher.should_receive(:new).with(:foo, 3) { stub('matcher').as_null_object }

          obj.foo(3)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rspec-expectations-2.0.0.beta.8 spec/rspec/matchers/dsl_spec.rb
rspec-expectations-2.0.0.beta.7 spec/rspec/matchers/dsl_spec.rb
rspec-expectations-2.0.0.beta.6 spec/rspec/matchers/dsl_spec.rb
rspec-expectations-2.0.0.beta.5 spec/rspec/matchers/dsl_spec.rb
rspec-expectations-2.0.0.beta.4 spec/rspec/matchers/dsl_spec.rb