Sha256: 9cae68ccd7f4e1404f6176472dfbd94e0fbbc1419e28000a6dda69ab602dacc2

Contents?: true

Size: 1.57 KB

Versions: 9

Compression:

Stored size: 1.57 KB

Contents

# encoding: UTF-8

require "spec_helper"

describe Tetra::Scriptable do
  include Tetra::Mockers

  before(:each) do
    create_mock_project

    @project.from_directory do
      FileUtils.mkdir_p(File.join("src", "test-package"))
      @project.dry_run

      history = ["tetra dry-run start --unwanted-options",
                 "cd somewhere significant",
                 "mvn --options",
                 "tetra dry-run finish -a"
                ]

      @project.finish(history)
    end

    create_mock_executable("ant")
    create_mock_executable("mvn")
  end

  after(:each) do
    delete_mock_project
  end

  describe "#generate_build_script" do
    it "generates a build script from the history" do
      @project.from_directory do
        @package = Tetra::Package.new(@project)
        @package.to_script

        lines = File.readlines(File.join("packages", "test-project", "build.sh"))

        expect(lines).to include("#!/bin/bash\n")
        expect(lines).to include("cd somewhere significant\n")
        expect(lines).to include("$PROJECT_PREFIX/kit/mvn/bin/mvn \
-Dmaven.repo.local=$PROJECT_PREFIX/kit/m2 --settings $PROJECT_PREFIX/kit/m2/settings.xml \
--strict-checksums -o --options\n"
                                )

        expect(lines).not_to include("some earlier command\n")
        expect(lines).not_to include("tetra dry-run --unwanted-options\n")
        expect(lines).not_to include("tetra dry-run --unwanted-options\n")
        expect(lines).not_to include("tetra finish -a\n")
        expect(lines).not_to include("some later command\n")
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
tetra-2.0.4 spec/lib/fine/scriptable_spec.rb
tetra-2.0.3 spec/lib/fine/scriptable_spec.rb
tetra-2.0.2 spec/lib/fine/scriptable_spec.rb
tetra-2.0.1 spec/lib/fine/scriptable_spec.rb
tetra-2.0.0 spec/lib/fine/scriptable_spec.rb
tetra-1.2.2 spec/lib/scriptable_spec.rb
tetra-1.2.1 spec/lib/scriptable_spec.rb
tetra-1.2.0 spec/lib/scriptable_spec.rb
tetra-1.1.0 spec/lib/scriptable_spec.rb