Sha256: 8fdcc18cb2bff0fcd01677fc691c0fbd1979c4850580ffacb2e62de046709f37

Contents?: true

Size: 1.96 KB

Versions: 2

Compression:

Stored size: 1.96 KB

Contents

require "spec_helper"

describe "`tetra dry-run`", type: :aruba do
  it "does not start a dry-run if init has not run yet" do
    run_simple("tetra dry-run")

    expect(stderr_from("tetra dry-run")).to include("is not a tetra project directory")
  end

  it "does a dry-run build" do
    run_simple("tetra init --no-archive mypackage")
    cd("mypackage")

    run_interactive("tetra dry-run")
    type("echo ciao")
    type("echo ciao > ciao.jar")
    type("\u{0004}") # ^D (Ctrl+D), terminates bash with exit status 0

    expect(all_output).to include("Dry-run started")
    expect(all_output).to include("bash shell")
    expect(all_output).to include("ciao")
    expect(all_output).to include("Dry-run finished")

    # check that markers were written in git repo
    run_simple("git rev-list --format=%B --max-count=1 HEAD~")
    expect(stdout_from("git rev-list --format=%B --max-count=1 HEAD~")).to include("tetra: dry-run-started")

    run_simple("git rev-list --format=%B --max-count=1 HEAD")
    expect(stdout_from("git rev-list --format=%B --max-count=1 HEAD")).to include("tetra: dry-run-finished")
    expect(stdout_from("git rev-list --format=%B --max-count=1 HEAD")).to include("tetra: build-script-line: echo ciao")
  end

  it "does a scripted dry-run" do
    run_simple("tetra init --no-archive mypackage")
    cd("mypackage")

    run_interactive("tetra dry-run -s 'echo ciao > ciao.jar'")

    expect(all_output).to include("Scripted dry-run started")

    # check that markers were written in git repo
    run_simple("git rev-list --format=%B --max-count=1 HEAD~")
    expect(stdout_from("git rev-list --format=%B --max-count=1 HEAD~")).to include("tetra: dry-run-started")

    run_simple("git rev-list --format=%B --max-count=1 HEAD")
    expect(stdout_from("git rev-list --format=%B --max-count=1 HEAD")).to include("tetra: dry-run-finished")
    expect(stdout_from("git rev-list --format=%B --max-count=1 HEAD")).to include("tetra: build-script-line: echo ciao > ciao.jar")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tetra-2.0.6 spec/lib/coarse/dry_run_subcommand_spec.rb
tetra-2.0.5 spec/lib/coarse/dry_run_subcommand_spec.rb