Method: RSpec::Matchers#end_with

Defined in:
lib/rspec/matchers.rb

#end_with(*expected) ⇒ Object Also known as: a_collection_ending_with, a_string_ending_with, ending_with

Matches if the actual value ends with the expected value(s). In the case of a string, matches against the last expected.length characters of the actual string. In the case of an array, matches against the last expected.length elements of the actual array.

Examples:

expect("this string").to   end_with "string"
expect([0, 1, 2, 3, 4]).to end_with 4
expect([0, 2, 3, 4, 4]).to end_with 3, 4


543
544
545
# File 'lib/rspec/matchers.rb', line 543

def end_with(*expected)
  BuiltIn::EndWith.new(*expected)
end