Sha256: b020cecbece6d6f6ce576bd88ee470df4c2631b714d63fea62f16b86c3325296

Contents?: true

Size: 939 Bytes

Versions: 2

Compression:

Stored size: 939 Bytes

Contents

# coding: utf-8

require "rubygems"
require "bundler"
Bundler.setup

require 'date'
require 'stringio'
require 'rubygems'
require 'onix'


module ONIX::SpecHelpers

  def load_doc_and_root(subpath)
    data_path = File.join(File.dirname(__FILE__), '..', 'data')
    file1 = File.join(data_path, subpath)
    @doc = Nokogiri::XML::Document.parse(File.read(file1))
    @root = @doc.root
  end

end

include ONIX::SpecHelpers


RSpec::Matchers.define(:produce_the_tag) do |expected|
  match do |actual|
    actual.to_xml.to_s[0, expected.size] == expected
  end
end

RSpec::Matchers.define(:include_the_xml) do |expected|
  match do |actual|
    actual.to_xml.to_s.include?(expected)
  end

  failure_message_for_should do |actual|
    "expected '#{actual.to_xml.to_s}' to include the xml '#{expected}'"
  end

  failure_message_for_should_not do |actual|
    "expected '#{actual.to_xml.to_s}' not to include the xml '#{expected}'"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
milkfarm-onix-0.8.13 spec/spec_helper.rb
milkfarm-onix-0.8.12 spec/spec_helper.rb