Sha256: 67651bb1e73de68c9c1bfb73ee4a27623119ae2dd4c271a46b2e4c19f3bd5b5a

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 Bytes

Contents

RSpec::Matchers.define :parse do |expected|
  match do
    begin
      result = SDP::Parser.new.parse(expected)
    rescue Parslet::ParseFailed => ex
      puts ex
      raise
    end

    result
  end
end

RSpec::Matchers.define :be_a_valid_description do |expected|
  match do |actual|
    @result = if actual.is_a? SDP::Description
      actual
    else
      SDP::Description.new(actual)
    end

    @result.valid?
  end

  failure_message_for_should do
    "Expected had errors: #{@result.errors}"
  end

  failure_message_for_should_not do
    "Expected description not be valid, but it was. #{@result.inspect}"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sdp-0.2.9 spec/support/parser_matcher.rb