Sha256: e573ec99e5ae77272605674de26faf417406668a151e7ca8ff8430341a8b9378

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'
module Alf
  describe Operator::CommandMethods do
    
    let(:cmd){ Object.new.extend(Operator::CommandMethods) }
    
    describe "split_command_args" do
    
      subject{ cmd.send(:split_command_args, args) }

      describe "when applied to both operands and args" do
        let(:args)    { %w{op1 op2 -- a b c} }
        let(:expected){ [ %w{op1 op2}, %w{a b c} ] }
        it { should == expected }
      end
      
      describe "when applied to one operand only" do
        let(:args)    { %w{op1} }
        let(:expected){ [ %w{op1}, %w{} ] }
        it { should == expected }
      end
      
      describe "when applied to two operands only" do
        let(:args)    { %w{op1 op2} }
        let(:expected){ [ %w{op1 op2}, %w{} ] }
        it { should == expected }
      end
      
      describe "when applied to args only" do
        let(:args)    { %w{-- a b c} }
        let(:expected){ [ [$stdin], %w{a b c} ] }
        it { should == expected }
      end
      
    end
      
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-0.9.3 spec/unit/operator/test_command_methods.rb
alf-0.9.2 spec/unit/operator/test_command_methods.rb
alf-0.9.1 spec/unit/operator/test_command_methods.rb
alf-0.9.0 spec/operator/command_methods_spec.rb