Sha256: a4572051c7e40a004c8513fefc5683c81d8b86df91e8122e17bd7a6149dd4f92

Contents?: true

Size: 846 Bytes

Versions: 2

Compression:

Stored size: 846 Bytes

Contents

module BagitMatchers

  class BeIn

    def initialize(*expected_collection)
      @expected = expected_collection
    end

    def matches?(target)
      @target = target
      @expected.include? @target
    end

    def failure_message
      "expected <#{@target}> to be in collection <#{@expected}>"
    end

    def negative_failure_message
      "expected <#{@target}> to not be in collection <#{@expected}>"
    end

  end

  def be_in(*expected_collection)
    BeIn.new(*expected_collection)
  end

  class ExistOnFS

    def matches?(target)
      @target = target
      File.exist? target
    end

    def failure_message
      "expected <#{@target}> to exist, but it doesn't"
    end

    def negative_failure_message
      "expected <#{@target}> to not exist but it does"
    end

  end

  def exist_on_fs
    ExistOnFS.new
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bagit-0.3.2 spec/util/bagit_matchers.rb
bagit-0.3.2.pre spec/util/bagit_matchers.rb