Sha256: 0b002315d18f9552c74e81df76180962cd874643dd07fb5a7f0d1917b32ed2cc

Contents?: true

Size: 897 Bytes

Versions: 2

Compression:

Stored size: 897 Bytes

Contents

module AktionTest
  module Matchers
    module FileSystem
      module DirectoryExistance
        def be_a_directory
          Matcher.new
        end

        class Matcher < Matchers::Base
          def initialize
            super
          end

        protected
          
          def perform_match!
            directory_exists?
          end
          
          def expectation
            "#{@subject} to be a directory."
          end

          def problems_for_should
            if File.exists? @subject
              unless File.directory? @subject
                "#{@subject} is not a directory."
              end
            else
              "#{@subject} does not exist."
            end
          end

          def problems_for_should_not
          end

          def directory_exists?
            Dir.exists? @subject
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aktion_test-0.3.1 lib/aktion_test/matchers/file_system/directory_existance.rb
aktion_test-0.3.0 lib/aktion_test/matchers/file_system/directory_existance.rb