class Barometer::Support::Matchers::HaveForecast
Public Class Methods
new(*paths)
click to toggle source
# File lib/barometer/support/matchers/have_forecast.rb, line 14 def initialize(*paths) @paths = paths end
Public Instance Methods
as_format(format)
click to toggle source
# File lib/barometer/support/matchers/have_forecast.rb, line 41 def as_format(format) @format = format self end
as_value(value)
click to toggle source
# File lib/barometer/support/matchers/have_forecast.rb, line 36 def as_value(value) @value = value self end
description()
click to toggle source
# File lib/barometer/support/matchers/have_forecast.rb, line 32 def description "have correct forecast value for #{@paths.join('.')}" end
failure_message()
click to toggle source
# File lib/barometer/support/matchers/have_forecast.rb, line 28 def failure_message "expected that '#{@result}' matches '#{@value || @format}'" end
matches?(subject)
click to toggle source
# File lib/barometer/support/matchers/have_forecast.rb, line 18 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