Sha256: def947872b73fc4d6a11442fffa8243e7be837148d1977956e4029f214d9f4ca

Contents?: true

Size: 551 Bytes

Versions: 17

Compression:

Stored size: 551 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_for_should 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

17 entries across 17 versions & 3 rubygems

Version Path
bourbon-4.3.4 spec/support/matchers/have_value.rb
bourbon-4.3.3 spec/support/matchers/have_value.rb
bourbon-4.3.2 spec/support/matchers/have_value.rb
bourbon-4.3.1 spec/support/matchers/have_value.rb
bourbon-4.3.0 spec/support/matchers/have_value.rb
bourbon-4.2.7 spec/support/matchers/have_value.rb
styler-sass-0.1.8.alpha spec/support/matchers/have_value.rb
styler-sass-0.1.7 spec/support/matchers/have_value.rb
styler-sass-0.1.7.alpha spec/support/matchers/have_value.rb
styler-sass-0.1.5.alpha spec/support/matchers/have_value.rb
bourbon-4.2.6 spec/support/matchers/have_value.rb
bourbon-4.2.5 spec/support/matchers/have_value.rb
bourbon-5.0.0.alpha.0 spec/support/matchers/have_value.rb
bourbon-4.2.4 spec/support/matchers/have_value.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/bourbon-4.2.3/spec/support/matchers/have_value.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/bourbon-4.2.3/spec/support/matchers/have_value.rb
bourbon-4.2.3 spec/support/matchers/have_value.rb