Sha256: c4cea6bc990d969029b3ddeb936b483bf23e60c1262936176e4e5455690ff3a0

Contents?: true

Size: 905 Bytes

Versions: 9

Compression:

Stored size: 905 Bytes

Contents

require 'spec_helper'
require 'command_mapper/types/input_file'

describe CommandMapper::Types::InputFile 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 [false, 'file does not exist (...)']" do
        expect(subject.validate(value)).to eq(
          [false, "file 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

9 entries across 9 versions & 1 rubygems

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