Method: RSpec::Matchers#start_with

Defined in:
lib/rspec/matchers.rb

#start_with(*expected) ⇒ Object Also known as: a_collection_starting_with, a_string_starting_with, starting_with

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

Examples:

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


828
829
830
# File 'lib/rspec/matchers.rb', line 828

def start_with(*expected)
  BuiltIn::StartWith.new(*expected)
end