Sha256: 94c4b001eb49dcbb695e1c19ffa18464c51e5053672a589f97774af2b5a29aeb

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'
require 'wlang/command'
module WLang
  describe Command, 'install' do

    class Command
      public :install
    end

    let(:cmd){ Command.new }

    subject{
      cmd.install(argv)
    }
    
    context 'with empty ARGV' do
      let(:argv){ [] }

      it 'raises an error' do
        lambda{
          subject
        }.should raise_error
      end
    end

    context 'with a single unexisting file' do
      let(:argv){ [ "foo" ] }

      it 'raises an error' do
        lambda{
          subject
        }.should raise_error
      end
    end

    context 'with a single existing file' do
      let(:argv){ [ __FILE__ ] }

      it 'sets the file correctly' do
        subject
        cmd.tpl_file.should eq(Path(__FILE__))
      end
    end

    context 'with an existing file and key/value pairs' do
      let(:argv){ [ __FILE__, "foo", "bar", "name", "wlang" ] }

      it 'sets the file correctly' do
        subject
        cmd.tpl_file.should eq(Path(__FILE__))
      end

      it 'sets the context correctly' do
        subject
        cmd.context.should eq("foo" => "bar", "name" => "wlang")
      end
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
wlang-3.0.1 spec/unit/command/test_install.rb
wlang-3.0.0 spec/unit/command/test_install.rb
wlang-2.3.1 spec/unit/command/test_install.rb
wlang-2.3.0 spec/unit/command/test_install.rb
wlang-2.2.4 spec/unit/command/test_install.rb
wlang-2.2.3 spec/unit/command/test_install.rb
wlang-2.2.2 spec/unit/command/test_install.rb
wlang-2.2.1 spec/unit/command/test_install.rb
wlang-2.2.0 spec/unit/command/test_install.rb