Sha256: 9b687e1a1dd785e516a8e58ad0245c94543f96c02dab2994492fa19250390437

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe Evrone::CI::Router::Queue do
  let(:travis) { create :travis }
  let(:queue)  { described_class.new travis }
  let(:expected_before_script) {
    s = ["set -e"]
    s << "export LC_ALL=en_US.UTF8"
    s << "eval \"$(rbenv init -)\" || true"
    s << %{
      rbenv shell
        $(rbenv versions |
          sed -e 's/^*/ /' |
          awk '{print $1}' |
          grep -v 'system' |
          grep '2.0.0' |
          tail -n1)
    }.compact
    s << 'export BUNDLE_GEMFILE=${PWD}/Gemfile'
    s << "export GEM_HOME=/tmp/.rubygems"
    trace s, "env"
    s << "gem query -q -in '^bundler$' > /dev/null || gem install bundler -q --no-rdoc --no-ri"
    trace s, "ruby --version"
    trace s, "gem --version"
    trace s, "bundle --version"
    trace s, "bundle install"
    trace s, "echo before_script"
    s.join("\n")
  }
  let(:expected_script) {
    s = ["set -e"]
    trace s, "RAILS_ENV=test ls -1 && echo DONE!"
    s.join("\n")
  }
  subject { queue }

  its(:travis) { should eq travis }

  context "to_before_script" do
    subject { queue.to_before_script }

    it { should eq expected_before_script }
  end

  context "to_script" do
    subject { queue.to_script }

    it { should eq expected_script }
  end

  def trace(s, cmd)
    s << "echo #{Shellwords.escape "$ " + cmd}"
    s << cmd
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
evrone-ci-router-0.2.0.pre0 spec/lib/queue_spec.rb