Method: Object#have_data

Defined in:
lib/extensions/mspec/mspec/matchers/have_data.rb

#have_data(data, mode = "rb:binary") ⇒ Object

Opens a file specified by the string the matcher is called on and compares the data passed to the matcher with the contents of the file. Expects to match the first N bytes of the file with data. For example, suppose @name is the name of a file:

@name.should have_data("123")

passes if the file @name has “123” as the first 3 bytes. The file can contain more bytes than data. The extra bytes do not affect the result.



46
47
48
# File 'lib/extensions/mspec/mspec/matchers/have_data.rb', line 46

def have_data(data, mode="rb:binary")
  HaveDataMatcher.new(data, mode)
end