Sha256: da5686425e22ca9a13f34cea93137d6a0569aa7f01fb4785a04672c97b6aff22

Contents?: true

Size: 729 Bytes

Versions: 2

Compression:

Stored size: 729 Bytes

Contents

if RUBY_VERSION >= '1.9' && ENV.has_key?('COVERAGE')
  require 'simplecov'
  SimpleCov.start
end

require 'rpub'
require 'nokogiri'

FIXTURES_DIRECTORY = File.expand_path('../fixtures', __FILE__)

RSpec::Matchers.define :remove_file do |filename|
  match do |block|
    before = File.exist?(filename)
    block.call
    after = File.exist?(filename)
    before && !after
  end
end

RSpec::Matchers.define :create_file do |*filenames|
  match do |block|
    before = filenames.all?(&File.method(:exist?))
    block.call
    after = filenames.all?(&File.method(:exist?))
    !before && after
  end
end

RSpec::Matchers.define :have_xpath do |xpath, *args|
  match do |xml|
    Nokogiri::XML(xml).xpath(xpath, *args).any?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rpub-0.4.0 spec/spec_helper.rb
rpub-0.3.0 spec/spec_helper.rb