Class: Fakes::RSpec::ReceivedOccurrencesCriteria

Inherits:
Object
  • Object
show all
Defined in:
lib/fakes_rspec/received_occurrences_criteria.rb

Instance Method Summary collapse

Constructor Details

#initialize(received_criteria, the_call, occurrence) ⇒ ReceivedOccurrencesCriteria

Returns a new instance of ReceivedOccurrencesCriteria.



4
5
6
7
8
# File 'lib/fakes_rspec/received_occurrences_criteria.rb', line 4

def initialize(received_criteria,the_call,occurrence)
  @received_criteria = received_criteria
  @the_call = the_call
  @occurrence = occurrence
end

Instance Method Details

#is_satisfied_by(*args) ⇒ Object



10
11
12
13
# File 'lib/fakes_rspec/received_occurrences_criteria.rb', line 10

def is_satisfied_by(*args)
  return @received_criteria.is_satisfied_by(*args) &&
    @occurrence.is_satisfied_by((args.count == 0 ? @the_call.total_times_called : @the_call.called_with(*args).times_called))
end