Sha256: 663fc3fc79543cf346b8d4c9f4a76e3d7e5d21df386fdbd1742334d01dea5291
Contents?: true
Size: 1.36 KB
Versions: 14
Compression:
Stored size: 1.36 KB
Contents
require 'spec_helper' describe Vx::ContainerConnector::Local do let(:conn) { described_class.new } subject { conn } it { should be } context "work_dir" do it "by default should be inside Dir.tmpdir" do expect(conn.work_dir).to eq("#{Dir.tmpdir}/.vx_local_connector") end it "when passed via options, should be" do expect(described_class.new(work_dir: "/tmp").work_dir).to eq '/tmp' end end context "start container" do it "spawner id should eq local" do rs = nil conn.start do |spawner| rs = spawner.id end expect(rs).to eq 'local' end context "and spawn script" do it "successfuly" do rs = "" code = nil conn.start do |spawner| code = spawner.spawn("echo $PWD") do |out| rs << out end end dir = "#{Dir.tmpdir}/.vx_local_connector\n" if RUBY_PLATFORM =~ /darwin/ dir.gsub!(/^\/var/, '/private/var') end expect(rs).to eq dir expect(code).to eq 0 end it "failed" do code = nil rs = "" conn.start do |spawner| code = spawner.spawn('ls /notexists') do |out| rs << out end end expect(rs).to match(/No such file or directory/) expect([1,2]).to be_include(code) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems