Sha256: b45b0787f569933627484d88537601ac3ce700248004430902963f013ebafe1c

Contents?: true

Size: 913 Bytes

Versions: 3

Compression:

Stored size: 913 Bytes

Contents

require 'spec_helper'
require 'command_mapper/types/input_dir'

describe CommandMapper::Types::InputDir do
  describe "#validate" do
    context "when given a valid directory path" do
      let(:value) { __dir__ }

      it "must return true" do
        expect(subject.validate(value)).to be(true)
      end
    end

    context "when given a valid file path" do
      let(:value) { __FILE__ }

      it "must return [false, 'directory does not exist (...)']" do
        expect(subject.validate(value)).to eq(
          [false, "directory does not exist (#{value.inspect})"]
        )
      end
    end

    context "when given a path that does not exist" do
      let(:value) { "/path/does/not/exist" }

      it "must return [false, 'path does not exist (...)']" do
        expect(subject.validate(value)).to eq(
          [false, "path does not exist (#{value.inspect})"]
        )
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
command_mapper-0.3.2 spec/types/input_dir_spec.rb
command_mapper-0.3.1 spec/types/input_dir_spec.rb
command_mapper-0.3.0 spec/types/input_dir_spec.rb