Sha256: 4acac6f98ff9e29580b42668583432c39891d4e6264d1f1e22251cdb5beb63d9

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe Vos::Box do
  with_tmp_spec_dir

  before do
    driver = Vos::Drivers::Local.new root: spec_dir
    @box = Vos::Box.new driver
    @box.stub :puts
  end

  describe 'vfs integration' do
    it 'smoke test' do
      @box['/'].exist?.should be_true
    end

    it 'vfs integration' do
      @box['/'].bash("echo 'ok'").should == "ok\n"
    end
  end

  describe "shell" do
    it 'bash' do
      @box.bash("echo 'ok'").should == "ok\n"
    end

    it 'bash working dir should be /' do
      @box.bash('pwd').should == "/\n"
    end

    it 'check with regex' do
      @box.bash "echo 'ok'", /ok/
      -> {@box.bash "echo 'ok'", /no/}.should raise_error(/not match/)
    end

    it "exec" do
      @box.exec("echo 'ok'").should == [0, "ok\n", ""]
    end

    it 'home' do
      @box.home.should_not be_nil
    end

    it 'env' do
      @box.env.should == {}
      @box.env = {a: 'b'}

      @box.env c: 'd' do
        @box.env.should == {a: 'b', c: 'd'}
      end
      @box.env.should == {a: 'b'}

      @box.env(c: 'd')
      @box.env.should == {a: 'b', c: 'd'}

      @box.env('ls').should == "a=b c=d && ls"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vos-0.4.2 spec/box_spec.rb
vos-0.4.1 spec/box_spec.rb
vos-0.4.0 spec/box_spec.rb