Sha256: 06b3900666ac74a03509e3e81618287af52d589ced762f1dd8cbc33aaa70d313

Contents?: true

Size: 1.67 KB

Versions: 46

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'
require 'yaml'
require 'tmpdir'
require 'fileutils'

describe "(integration) nodejs" do
  let(:path) { Dir.tmpdir + "/vx-builder-test" }

  before do
    FileUtils.rm_rf(path)
    FileUtils.mkdir_p(path)
  end
  after { FileUtils.rm_rf(path) }

  def build(file, options = {})
    config = Vx::Builder::BuildConfiguration.from_yaml(file)
    matrix = Vx::Builder.matrix config
    options[:task] ||= create(:task)
    script = Vx::Builder.script(options[:task], matrix.build.first)
    OpenStruct.new script: script, matrix: matrix
  end

  it "should succesfuly run lang/nodejs", real: true do
    file = {"language" => "node_js"}.to_yaml
    task = create(
      :task,
      sha: "HEAD",
      branch: "lang/nodejs"
    )

    b = build(file, task: task)
    Dir.chdir(path) do
      File.open("script.sh", "w") do |io|
        io.write "set -e\n"
        io.write b.script.to_before_script
        io.write b.script.to_script
      end
      system("env", "-", "USER=$USER", "HOME=#{path}", "bash", "script.sh" )
      expect($?.to_i).to eq 0
    end
  end

  it "should succesfuly run lang/nodejs witn npm", real: true do
    file = {
      "language" => "node_js",
      'before_script' => "npm install -g bower",
      'script' => 'bower --version' }.to_yaml
    task = create(
      :task,
      sha: "HEAD",
      branch: "lang/nodejs"
    )

    b = build(file, task: task)
    Dir.chdir(path) do
      File.open("script.sh", "w") do |io|
        io.write "set -e\n"
        io.write b.script.to_before_script
        io.write b.script.to_script
      end
      system("env", "-", "USER=$USER", "HOME=#{path}", "bash", "script.sh" )
      expect($?.to_i).to eq 0
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
vx-builder-0.5.18 spec/integration/nodejs_spec.rb
vx-builder-0.5.17 spec/integration/nodejs_spec.rb
vx-builder-0.5.16 spec/integration/nodejs_spec.rb
vx-builder-0.5.15 spec/integration/nodejs_spec.rb
vx-builder-0.5.14 spec/integration/nodejs_spec.rb
vx-builder-0.5.13 spec/integration/nodejs_spec.rb