Sha256: f45aa8cbf463f902934c3d7346dd616c983a07c05d095f85a8bbf21f35d4590e
Contents?: true
Size: 899 Bytes
Versions: 3
Compression:
Stored size: 899 Bytes
Contents
require_relative 'path' require_relative 'formats' module Barometer module Matchers def have_forecast(*paths) HaveForecast.new(*paths) end class HaveForecast include Barometer::Matchers::Formats def initialize(*paths) @paths = paths end def matches?(subject) @result = Walker.new(subject.forecast[0]).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 forecast 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_forecast.rb |
barometer-0.9.1 | spec/support/matchers/have_forecast.rb |
barometer-0.9.0 | spec/support/matchers/have_forecast.rb |