Sha256: 6969bba3b50d14e16d3f275809da39428e7bf735aabe11854023929516c284c6

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

describe TooDoo::Arguments do
  subject { described_class.new(args) }
  let(:command)  { 'add' }
  let(:argument) { 'task' }
  let(:args)     { [] }

  context 'when command and argument passed' do
    let(:second_argument) { 'argument' }
    let(:args) { [command, argument, second_argument] }

    describe '#command' do
      it { expect(subject.command).to eq(command) }
    end

    describe '#argument' do
      it { expect(subject.argument).to eq([argument, second_argument]) }
    end
  end

  context 'when only command passed' do
    let(:args) { [command] }

    describe '#command' do
      it { expect(subject.command).to eq(command) }
    end

    describe '#argument' do
      it { expect(subject.argument).to be_empty }
    end
  end

  context 'when nothing passed' do
    let(:args) { [] }

    describe '#command' do
      it { expect(subject.command).to eq(:command_missing) }
    end

    describe '#argument' do
      it { expect(subject.argument).to be_empty }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
toodoo-0.1.1 spec/toodoo/arguments_spec.rb