Sha256: 940149ca3afed436c54c5f773fc4f413269c02d7d2ef18d12cd34bdf324bbdcd

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

module RSpec
  def self.create_received_criteria_from(the_call)
    return DevelopWithPassion::Fakes::RSpec::ReceivedCriteria.new(the_call)
  end
  def self.create_received_occurences_criteria_from(the_call,occurence)
    return DevelopWithPassion::Fakes::RSpec::ReceivedOccurencesCriteria.new(create_received_criteria_from(the_call),the_call,occurence)
  end

  Matchers.define :have_received do|symbol,*args|
    @occurence_spec = DevelopWithPassion::Fakes::RSpec::NulloSpecification.instance

    chain :once do
      @occurence_spec = DevelopWithPassion::Fakes::RSpec::Occurances.exact(1)
    end
    chain :twice do
      @occurence_spec = DevelopWithPassion::Fakes::RSpec::Occurances.exact(2)
    end
    chain :at_least_once do
      @occurence_spec = DevelopWithPassion::Fakes::RSpec::Occurances.at_least(1)
    end
    chain :at_least_twice do
      @occurence_spec = DevelopWithPassion::Fakes::RSpec::Occurances.at_least(2)
    end
    chain :at_most_once do
      @occurence_spec = DevelopWithPassion::Fakes::RSpec::Occurances.at_most(1)
    end
    chain :at_most_twice do
      @occurence_spec = DevelopWithPassion::Fakes::RSpec::Occurances.at_most(2)
    end
    chain :at_least do|times|
      @occurence_spec =  DevelopWithPassion::Fakes::RSpec::Occurances.at_least(times)
    end
    chain :at_most do|times|
      @occurence_spec =  DevelopWithPassion::Fakes::RSpec::Occurances.at_most(times)
    end
    chain :exactly do|times|
      @occurence_spec = DevelopWithPassion::Fakes::RSpec::Occurances.exact(times)
    end
    chain :occurs do|the_proc|
      @occurence_spec = DevelopWithPassion::Fakes::RSpec::Occurances.from_block(the_proc)
    end
    match do|the_fake|
      RSpec.create_received_occurences_criteria_from(the_fake.received(symbol),@occurence_spec).is_satisfied_by(*args)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
developwithpassion_fakes-rspec-0.0.8 lib/core/matcher.rb