Sha256: 6597fae93e28669c1f1ba80f4777896e261d90b8f3081451ca504a3b8cc2b309

Contents?: true

Size: 873 Bytes

Versions: 6

Compression:

Stored size: 873 Bytes

Contents

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

describe CommandMapper::Types::InputDir do
  describe "#validate" do
    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 valid directory path" do
      let(:value) { __dir__ }

      it "must return true" do
        expect(subject.validate(value)).to eq(true)
      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

6 entries across 6 versions & 1 rubygems

Version Path
command_mapper-0.2.1 spec/types/input_dir_spec.rb
command_mapper-0.2.0 spec/types/input_dir_spec.rb
command_mapper-0.1.2 spec/types/input_dir_spec.rb
command_mapper-0.1.1 spec/types/input_dir_spec.rb
command_mapper-0.1.0 spec/types/input_dir_spec.rb
command_mapper-0.1.0.pre1 spec/types/input_dir_spec.rb