Sha256: 6de5a9544b1dd46843463c0a1d6d254a5c98802531963141da767abf6e2197e5

Contents?: true

Size: 435 Bytes

Versions: 3

Compression:

Stored size: 435 Bytes

Contents

RSpec::Matchers.define :have_value do |expected|
  match do |actual|
    selector_id = actual.sub('$','#')
    value_attribute = ParserSupport.parser.find_by_selector(selector_id)[0]

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

  failure_message do |actual|
    %{expected variable #{actual} to have value "#{expected}"}
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
neat-1.7.0 spec/support/matchers/have_value.rb
neat-1.7.0.rc spec/support/matchers/have_value.rb
neat-1.7.0.pre spec/support/matchers/have_value.rb