Parent

Files

Class/Module Index [+]

Quicksearch

HaveDataMatcher

Public Class Methods

new(data) click to toggle source
# File lib/mspec/matchers/have_data.rb, line 5
def initialize(data)
  @data = data
end

Public Instance Methods

failure_message() click to toggle source
# File lib/mspec/matchers/have_data.rb, line 23
def failure_message
  ["Expected #{@name}",
   "to have data #{@data.pretty_inspect}"]
end
matches?(name) click to toggle source
# File lib/mspec/matchers/have_data.rb, line 9
def matches?(name)
  @name = name

  if FeatureGuard.enabled? :encoding
    size = @data.bytesize
  else
    size = @data.size
  end

  File.open @name, fmode("rb:binary") do |f|
    return f.read(size) == @data
  end
end
negative_failure_message() click to toggle source
# File lib/mspec/matchers/have_data.rb, line 28
def negative_failure_message
  ["Expected #{@name}",
   "not to have data #{@data.pretty_inspect}"]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.