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-7.3.0 spec/support/matchers/have_value.rb
bourbon-7.2.0 spec/support/matchers/have_value.rb
bourbon-7.1.0 spec/support/matchers/have_value.rb
bourbon-7.0.0 spec/support/matchers/have_value.rb
neat-4.0.0 spec/support/matchers/have_value.rb
bourbon-6.0.0 spec/support/matchers/have_value.rb
neat-3.0.1 spec/support/matchers/have_value.rb
bourbon-5.1.0 spec/support/matchers/have_value.rb
neat-3.0.0 spec/support/matchers/have_value.rb
bourbon-5.0.1 spec/support/matchers/have_value.rb
bourbon-5.0.0 spec/support/matchers/have_value.rb
neat-2.1.0 spec/support/matchers/have_value.rb
bourbon-5.0.0.beta.8 spec/support/matchers/have_value.rb
neat-2.0.0 spec/support/matchers/have_value.rb
neat-2.0.0.beta.2 spec/support/matchers/have_value.rb
bourbon-5.0.0.beta.7 spec/support/matchers/have_value.rb
doggystyle-0.1.0 spec/support/matchers/have_value.rb
neat-2.0.0.beta.1 spec/support/matchers/have_value.rb
neat-2.0.0.alpha.1 spec/support/matchers/have_value.rb
bourbon-5.0.0.beta.6 spec/support/matchers/have_value.rb