module RSpec::Matchers::BuiltIn::CountExpectation

@api private Abstract class to implement ‘once`, `at_least` and other count constraints.

Attributes

Public Instance Methods

@api public Specifies the minimum number of times the method is expected to match

# File rspec-expectations/lib/rspec/matchers/built_in/count_expectation.rb, line 42
def at_least(number)
  set_expected_count(:>=, number)
  self
end

@api public Specifies the maximum number of times the method is expected to match

# File rspec-expectations/lib/rspec/matchers/built_in/count_expectation.rb, line 35
def at_most(number)
  set_expected_count(:<=, number)
  self
end

@api public Specifies that the method is expected to match the given number of times.

# File rspec-expectations/lib/rspec/matchers/built_in/count_expectation.rb, line 28
def exactly(number)
  set_expected_count(:==, number)
  self
end

@api public Specifies that the method is expected to match once.

# File rspec-expectations/lib/rspec/matchers/built_in/count_expectation.rb, line 10
def once
  exactly(1)
end

@api public Specifies that the method is expected to match thrice.

# File rspec-expectations/lib/rspec/matchers/built_in/count_expectation.rb, line 22
def thrice
  exactly(3)
end

@api public No-op. Provides syntactic sugar.

# File rspec-expectations/lib/rspec/matchers/built_in/count_expectation.rb, line 49
def times
  self
end

@api public Specifies that the method is expected to match twice.

# File rspec-expectations/lib/rspec/matchers/built_in/count_expectation.rb, line 16
def twice
  exactly(2)
end