Sha256: d363e42751a8896cfd15a228e8e46afef2ca483f5c234e12c246ce871e392543

Contents?: true

Size: 540 Bytes

Versions: 25

Compression:

Stored size: 540 Bytes

Contents

RSpec::Matchers.define :have_value do |expected|
  match do |variable|
    selector_class = variable.sub("$", ".")
    @value_attribute = ParserSupport.parser.find_by_selector(selector_class)[0]

    unless @value_attribute.nil?
      actual_value = @value_attribute.split(":")[1].strip.sub(";", "")
      actual_value == expected
    end
  end

  failure_message do |variable_name|
    value_attribute = @value_attribute.to_s
    %{Expected variable #{variable_name} to have value "#{expected}".
      Had "#{value_attribute}".}
  end
end

Version data entries

25 entries across 25 versions & 3 rubygems

Version Path
bourbon-5.0.0.beta.5 spec/support/matchers/have_value.rb
bourbon-5.0.0.beta.4 spec/support/matchers/have_value.rb
bourbon-5.0.0.beta.3 spec/support/matchers/have_value.rb
bourbon-5.0.0.beta.2 spec/support/matchers/have_value.rb
bourbon-5.0.0.beta.1 spec/support/matchers/have_value.rb