Sha256: 75e68fa457182f553eeb43bcc895c0066ec6469702750ca7d7944a430dbe46bc

Contents?: true

Size: 808 Bytes

Versions: 9

Compression:

Stored size: 808 Bytes

Contents

require 'spec_helper'
require 'command_mapper/types/input_path'

describe CommandMapper::Types::InputPath do
  describe "#validate" do
    context "when given a valid file path" do
      let(:value) { __FILE__ }

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

    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 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

9 entries across 9 versions & 1 rubygems

Version Path
command_mapper-0.3.2 spec/types/input_path_spec.rb
command_mapper-0.3.1 spec/types/input_path_spec.rb
command_mapper-0.3.0 spec/types/input_path_spec.rb
command_mapper-0.2.1 spec/types/input_path_spec.rb
command_mapper-0.2.0 spec/types/input_path_spec.rb
command_mapper-0.1.2 spec/types/input_path_spec.rb
command_mapper-0.1.1 spec/types/input_path_spec.rb
command_mapper-0.1.0 spec/types/input_path_spec.rb
command_mapper-0.1.0.pre1 spec/types/input_path_spec.rb