Sha256: 8598d1279d31648ac3f0d1a0ebae6237df6639817142c890560c7eaffcf68a0e
Contents?: true
Size: 866 Bytes
Versions: 3
Compression:
Stored size: 866 Bytes
Contents
require_relative 'path' require_relative 'formats' module Barometer module Matchers def have_data(*paths) HaveData.new(*paths) end class HaveData include Barometer::Matchers::Formats def initialize(*paths) @paths = paths end def matches?(subject) @result = Walker.new(subject).follow(@paths) if @format is_of_format?(@format, @result) else @result == @value || @result.to_f == @value end end def failure_message "expected that '#{@result}' matches '#{@value || @format}'" end def description "have correct value for #{@paths.join('.')}" end def as_value(value) @value = value self end def as_format(format) @format = format self end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
barometer-0.9.2 | spec/support/matchers/have_data.rb |
barometer-0.9.1 | spec/support/matchers/have_data.rb |
barometer-0.9.0 | spec/support/matchers/have_data.rb |