diff --git a/Gemfile.lock b/Gemfile.lock index 0a0327ac..47163d23 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,27 +1,31 @@ PATH remote: . specs: - tetra (2.0.6) - clamp + tetra (2.0.7dev) + clamp (~> 1.3.2) erb (~> 2.2.3) - json_pure - open4 - rexml - rubyzip (>= 1.0) - text + json_pure (~> 2.6.2) + open4 (~> 1.3.4) + rexml (~> 3.2.5) + rubyzip (~> 2.3.2) + text (~> 1.3.1) GEM remote: https://rubygems.org/ specs: - aruba (0.6.2) - childprocess (>= 0.3.6) - cucumber (>= 1.1.1) - rspec-expectations (>= 2.7.0) + aruba (2.1.0) + bundler (>= 1.17, < 3.0) + childprocess (>= 2.0, < 5.0) + contracts (>= 0.16.0, < 0.18.0) + cucumber (>= 4.0, < 9.0) + rspec-expectations (~> 3.4) + thor (~> 1.0) ast (2.4.2) builder (3.2.4) cgi (0.3.2) childprocess (4.1.0) clamp (1.3.2) + contracts (0.17) cucumber (8.0.0) builder (~> 3.2, >= 3.2.4) cucumber-ci-environment (~> 9.0, >= 9.0.4) @@ -94,15 +98,16 @@ GEM sys-uname (1.2.2) ffi (~> 1.1) text (1.3.1) + thor (1.2.1) unicode-display_width (2.2.0) PLATFORMS x86_64-darwin-21 DEPENDENCIES - aruba (~> 0.6.2) - rake - rspec + aruba (~> 2.1.0) + rake (~> 13.0.6) + rspec (~> 3.11.0) rubocop (~> 1.35.1) tetra! diff --git a/spec/lib/coarse/dry_run_subcommand_spec.rb b/spec/lib/coarse/dry_run_subcommand_spec.rb index 1fba6c1d..9b2f0248 100644 --- a/spec/lib/coarse/dry_run_subcommand_spec.rb +++ b/spec/lib/coarse/dry_run_subcommand_spec.rb @@ -2,48 +2,61 @@ 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") + run_command("tetra dry-run") - expect(stderr_from("tetra dry-run")).to include("is not a tetra project directory") + expect(last_command_started).to have_output(/is not a tetra project directory/) + expect(last_command_started).to have_exit_status(0) 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 + # FIXME: Fix run_interactive() + # it "does a dry-run build" do + # run_command("tetra init --no-archive mypackage") + # expect(last_command_started).to be_successfully_executed + # expect(last_command_started).to have_exit_status(0) + # 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(last_command_started).to have_output(/Dry-run started/) + # expect(last_command_started).to have_output(/bash shell/) + # expect(last_command_started).to have_output(/ciao/) + # expect(last_command_started).to have_output(/Dry-run finished/) + # + # # check that markers were written in git repo + # run_command("git rev-list --format=%B --max-count=1 HEAD~") + # expect(last_command_started).to be_successfully_executed + # expect(last_command_started).to have_exit_status(0) + # expect(last_command_started).to have_output(/tetra: dry-run-started/) + # + # run_command("git rev-list --format=%B --max-count=1 HEAD") + # expect(last_command_started).to be_successfully_executed + # expect(last_command_started).to have_exit_status(0) + # expect(last_command_started).to have_output(/tetra: dry-run-finished/) + # expect(last_command_started).to have_output(/tetra: build-script-line: echo ciao/) + # end it "does a scripted dry-run" do - run_simple("tetra init --no-archive mypackage") + run_command("tetra init --no-archive mypackage") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) cd("mypackage") - run_interactive("tetra dry-run -s 'echo ciao > ciao.jar'") - - expect(all_output).to include("Scripted dry-run started") + run_command("tetra dry-run -s 'echo ciao > ciao.jar'") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/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") + run_command("git rev-list --format=%B --max-count=1 HEAD~") + expect(last_command_started).to have_output(/tetra: dry-run-started/) + + run_command("git rev-list --format=%B --max-count=1 HEAD") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/tetra: dry-run-finished/) + expect(last_command_started).to have_output(/tetra: build-script-line: echo ciao > ciao.jar/) end end diff --git a/spec/lib/coarse/generate_all_subcommand_spec.rb b/spec/lib/coarse/generate_all_subcommand_spec.rb index 19bb4719..b2588124 100644 --- a/spec/lib/coarse/generate_all_subcommand_spec.rb +++ b/spec/lib/coarse/generate_all_subcommand_spec.rb @@ -6,51 +6,61 @@ write_file("commons-collections.zip", archive_contents) # init project - run_simple("tetra init commons-collections commons-collections.zip") + run_command("tetra init commons-collections commons-collections.zip") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) cd(File.join("commons-collections", "src", "commons-collections4-4.4-src")) # first dry-run, all normal @aruba_timeout_seconds = 240 - run_interactive("tetra dry-run --very-very-verbose") + run_command("tetra dry-run --very-very-verbose") type("mvn package -DskipTests") type("\u{0004}") # ^D (Ctrl+D), terminates bash with exit status 0 - expect(all_output).to include("[INFO] BUILD SUCCESS") - expect(all_output).to include("Checking for tetra project") + expect(last_command_started).to have_output(/[INFO] BUILD SUCCESS/) + expect(last_command_started).to have_output(/Checking for tetra project/) # first generate-all, all normal - run_simple("tetra generate-all") + run_command("tetra generate-all") - expect(output_from("tetra generate-all")).to include("commons-collections-kit.spec generated") - expect(output_from("tetra generate-all")).to include("commons-collections-kit.tar.xz generated") - expect(output_from("tetra generate-all")).to include("build.sh generated") - expect(output_from("tetra generate-all")).to include("commons-collections.spec generated") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/commons-collections-kit.spec generated/) + expect(last_command_started).to have_output(/commons-collections-kit.tar.xz generated/) + expect(last_command_started).to have_output(/build.sh generated/) + expect(last_command_started).to have_output(/commons-collections.spec generated/) # patch one file append_to_file("README.txt", "patched by tetra test") # second dry-run fails: sources changed - run_simple("tetra dry-run") - expect(output_from("tetra dry-run")).to include("Changes detected in src") - expect(output_from("tetra dry-run")).to include("Dry run not started") + run_command("tetra dry-run") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/Changes detected in src/) + expect(last_command_started).to have_output(/Dry run not started/) # run patch - run_simple("tetra patch") + run_command("tetra patch") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) # third dry-run succeeds with patch - run_interactive("tetra dry-run") + run_command("tetra dry-run") type("mvn package -DskipTests") type("\u{0004}") # ^D (Ctrl+D), terminates bash with exit status 0 - expect(all_output).to include("[INFO] BUILD SUCCESS") + expect(last_command_started).to have_output(/[INFO] BUILD SUCCESS/) - run_simple("tetra generate-all --very-very-verbose") + run_command("tetra generate-all --very-very-verbose") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) - expect(output_from("tetra generate-all --very-very-verbose")).to include("commons-collections-kit.spec generated") - expect(output_from("tetra generate-all --very-very-verbose")).to include("commons-collections-kit.tar.xz generated") - expect(output_from("tetra generate-all --very-very-verbose")).to include("build.sh generated") - expect(output_from("tetra generate-all --very-very-verbose")).to include("commons-collections.spec generated") - expect(output_from("tetra generate-all --very-very-verbose")).to include("0001-Sources-updated.patch generated") + expect(last_command_started).to have_output(/commons-collections-kit.spec generated/) + expect(last_command_started).to have_output(/commons-collections-kit.tar.xz generated/) + expect(last_command_started).to have_output(/build.sh generated/) + expect(last_command_started).to have_output(/commons-collections.spec generated/) + expect(last_command_started).to have_output(/0001-Sources-updated.patch generated/) with_file_content("../../packages/commons-collections/commons-collections.spec") do |content| expect(content).to include("0001-Sources-updated.patch") @@ -62,63 +72,82 @@ write_file("commons-collections.zip", archive_contents) # init project - run_simple("tetra init -n commons-collections") + run_command("tetra init -n commons-collections") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) # add sources - run_simple("unzip commons-collections.zip -d commons-collections/src") + run_command("unzip commons-collections.zip -d commons-collections/src") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) cd("commons-collections") # first dry-run fails: sources changed - run_simple("tetra dry-run") - expect(output_from("tetra dry-run")).to include("Changes detected in src") - expect(output_from("tetra dry-run")).to include("Dry run not started") + run_command("tetra dry-run") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/Changes detected in src/) + expect(last_command_started).to have_output(/Dry run not started/) # run change-sources - run_simple("tetra change-sources ../commons-collections.zip") - expect(output_from("tetra change-sources ../commons-collections.zip")).to include("New sources committed") + run_command("tetra change-sources ../commons-collections.zip") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/New sources committed/) # second dry-run, all normal cd(File.join("src", "commons-collections4-4.4-src")) @aruba_timeout_seconds = 240 - run_interactive("tetra dry-run") + run_command("tetra dry-run") type("mvn package -DskipTests") type("\u{0004}") # ^D (Ctrl+D), terminates bash with exit status 0 - expect(all_output).to include("[INFO] BUILD SUCCESS") + expect(last_command_started).to have_output(/[INFO] BUILD SUCCESS/) # first generate-all, all normal - run_simple("tetra generate-all") + run_command("tetra generate-all") - expect(output_from("tetra generate-all")).to include("commons-collections-kit.spec generated") - expect(output_from("tetra generate-all")).to include("commons-collections-kit.tar.xz generated") - expect(output_from("tetra generate-all")).to include("build.sh generated") - expect(output_from("tetra generate-all")).to include("commons-collections.spec generated") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/commons-collections-kit.spec generated/) + expect(last_command_started).to have_output(/commons-collections-kit.tar.xz generated/) + expect(last_command_started).to have_output(/build.sh generated/) + expect(last_command_started).to have_output(/commons-collections.spec generated/) # patch one file append_to_file("README.txt", "patched by tetra test") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) # second dry-run fails: sources changed - run_simple("tetra dry-run") - expect(output_from("tetra dry-run")).to include("Changes detected in src") - expect(output_from("tetra dry-run")).to include("Dry run not started") + run_command("tetra dry-run") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/Changes detected in src/) + expect(last_command_started).to have_output(/Dry run not started/) # run patch - run_simple("tetra patch") + run_command("tetra patch") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) # third dry-run succeeds with patch - run_interactive("tetra dry-run") + run_command("tetra dry-run") type("mvn package -DskipTests") type("\u{0004}") # ^D (Ctrl+D), terminates bash with exit status 0 - expect(all_output).to include("[INFO] BUILD SUCCESS") + expect(last_command_started).to have_output(/[INFO] BUILD SUCCESS/) - run_simple("tetra generate-all") + run_command("tetra generate-all") + + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/commons-collections-kit.spec generated/) + expect(last_command_started).to have_output(/commons-collections-kit.tar.xz generated/) + expect(last_command_started).to have_output(/build.sh generated/) + expect(last_command_started).to have_output(/commons-collections.spec generated/) + expect(last_command_started).to have_output(/0001-Sources-updated.patch generated/) - expect(output_from("tetra generate-all")).to include("commons-collections-kit.spec generated") - expect(output_from("tetra generate-all")).to include("commons-collections-kit.tar.xz generated") - expect(output_from("tetra generate-all")).to include("build.sh generated") - expect(output_from("tetra generate-all")).to include("commons-collections.spec generated") - expect(output_from("tetra generate-all")).to include("0001-Sources-updated.patch generated") with_file_content("../../packages/commons-collections/commons-collections.spec") do |content| expect(content).to include("0001-Sources-updated.patch") diff --git a/spec/lib/coarse/generate_spec_subcommand_spec.rb b/spec/lib/coarse/generate_spec_subcommand_spec.rb index cd3b0884..5ef9723e 100644 --- a/spec/lib/coarse/generate_spec_subcommand_spec.rb +++ b/spec/lib/coarse/generate_spec_subcommand_spec.rb @@ -5,25 +5,32 @@ archive_contents = File.read(File.join("spec", "data", "commons-collections4-4.4-src.zip")) write_file("commons-collections.zip", archive_contents) - run_simple("tetra init --no-archive commons-collections") + run_command("tetra init --no-archive commons-collections") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) cd("commons-collections") cd("src") - run_simple("unzip ../../commons-collections.zip") + run_command("unzip ../../commons-collections.zip") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) cd("commons-collections4-4.4-src") - run_simple("tetra change-sources --no-archive") - expect(output_from("tetra change-sources --no-archive")).to include("New sources committed") + run_command("tetra change-sources --no-archive") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/New sources committed/) @aruba_timeout_seconds = 300 - run_interactive("tetra dry-run") + run_command("tetra dry-run") type("mvn package -DskipTests") type("\u{0004}") # ^D (Ctrl+D), terminates bash with exit status 0 - expect(all_output).to include("[INFO] BUILD SUCCESS") + # expect(last_command_started).to have_output(/[INFO] BUILD SUCCESS/) - run_simple("tetra generate-spec") - - expect(output_from("tetra generate-spec")).to include("Warning: source archive not found, package will not build") + run_command("tetra generate-spec") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/Warning: source archive not found, package will not build/) end end diff --git a/spec/lib/coarse/init_subcommand_spec.rb b/spec/lib/coarse/init_subcommand_spec.rb index 95117efb..a48e9efd 100644 --- a/spec/lib/coarse/init_subcommand_spec.rb +++ b/spec/lib/coarse/init_subcommand_spec.rb @@ -1,85 +1,97 @@ require "spec_helper" -describe "`tetra`", type: :aruba do +describe "`tetra`" do + it "shows an error if required parameters are not set" do - run_simple("tetra init", false) + run_command("tetra init") - expect(stderr_from("tetra init")).to include("parameter 'PACKAGE_NAME': no value provided") + expect(last_command_started).to have_output(/parameter 'PACKAGE_NAME': no value provided/) + expect(last_command_started).to have_exit_status(1) end it "shows an error if required parameters are not set, even if options are set" do - run_simple("tetra init -n", false) + run_command("tetra init -n") - expect(stderr_from("tetra init -n")).to include("parameter 'PACKAGE_NAME': no value provided") + expect(last_command_started).to have_output(/parameter 'PACKAGE_NAME': no value provided/) + expect(last_command_started).to have_exit_status(1) end it "shows an error if no sources are specified and -n is not set" do - run_simple("tetra init mypackage", false) - - expect(stderr_from("tetra init mypackage")).to include("please specify a source archive") + run_command("tetra init mypackage") - check_directory_presence(["mypackage"], false) + expect(last_command_started).to have_output(/please specify a source archive/) + expect(last_command_started).to have_exit_status(1) + expect(exist?("mypackage")).to be false end it "inits a new project without sources" do - run_simple("tetra init --no-archive mypackage") + run_command_and_stop("tetra init --no-archive mypackage") - expect(output_from("tetra init --no-archive mypackage")).to include("Project inited in mypackage/.") + expect(last_command_started).to have_output(/Project inited in mypackage/) + expect(last_command_started).to have_exit_status(0) + expect(exist?("mypackage")).to be true - check_directory_presence(["mypackage"], true) cd("mypackage") - check_directory_presence([".git", "kit", "src"], true) + expect(exist?(".git")).to be true + expect(exist?("kit")).to be true + expect(exist?("src")).to be true end it "inits a new project with a zip source file" do archive_contents = File.read(File.join("spec", "data", "commons-collections4-4.4-src.zip")) write_file("commons-collections.zip", archive_contents) - run_simple("tetra init commons-collections commons-collections.zip") - - output = output_from("tetra init commons-collections commons-collections.zip") - expect(output).to include("Project inited in commons-collections/.") - expect(output).to include("Sources decompressed in commons-collections/src/") - expect(output).to include("original archive copied in commons-collections/packages/.") - expect(output).to include("Please add any other precompiled build dependency to kit/.") + run_command("tetra init commons-collections commons-collections.zip") - check_directory_presence(["commons-collections"], true) + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/Project inited in commons-collections/) + expect(last_command_started).to have_output(/Sources decompressed in commons-collections/) + expect(last_command_started).to have_output(/original archive copied in commons-collections/) + expect(last_command_started).to have_output(/Please add any other precompiled build dependency to kit/) + expect(exist?("commons-collections")).to be true cd("commons-collections") - check_directory_presence([".git", "kit", "src", "packages"], true) - - check_directory_presence([File.join("src", "commons-collections4-4.4-src")], true) - check_file_presence([File.join("src", "commons-collections4-4.4-src", "pom.xml")], true) - - check_file_presence([File.join("packages", "commons-collections", "commons-collections.zip")], true) - - 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("Inital sources added from archive") + expect(exist?(".git")).to be true + expect(exist?("kit")).to be true + expect(exist?("src")).to be true + expect(exist?("packages")).to be true + expect(exist?(File.join("src", "commons-collections4-4.4-src"))).to be true + expect(exist?(File.join("src", "commons-collections4-4.4-src", "pom.xml"))).to be true + expect(exist?(File.join("packages", "commons-collections", "commons-collections.zip"))).to be true + + run_command("git rev-list --format=%B --max-count=1 HEAD") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/Inital sources added from archive/) end it "inits a new project with a tar source file" do archive_contents = File.read(File.join("spec", "data", "commons-collections4-4.4-src.tar.gz")) write_file("commons-collections.tar.gz", archive_contents) - run_simple("tetra init commons-collections commons-collections.tar.gz") - - output = output_from("tetra init commons-collections commons-collections.tar.gz") - expect(output).to include("Project inited in commons-collections/.") - expect(output).to include("Sources decompressed in commons-collections/src/") - expect(output).to include("original archive copied in commons-collections/packages/.") - expect(output).to include("Please add any other precompiled build dependency to kit/.") + run_command("tetra init commons-collections commons-collections.tar.gz") - check_directory_presence(["commons-collections"], true) + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/Project inited in commons-collections/) + expect(last_command_started).to have_output(/Sources decompressed in commons-collections/) + expect(last_command_started).to have_output(/original archive copied in commons-collections/) + expect(last_command_started).to have_output(/Please add any other precompiled build dependency to kit/) + expect(exist?("commons-collections")).to be true cd("commons-collections") - check_directory_presence([".git", "kit", "src", "packages"], true) - - check_directory_presence([File.join("src", "commons-collections4-4.4-src")], true) - check_file_presence([File.join("src", "commons-collections4-4.4-src", "pom.xml")], true) - - check_file_presence([File.join("packages", "commons-collections", "commons-collections.tar.gz")], true) - - 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("Inital sources added from archive") + expect(exist?(".git")).to be true + expect(exist?("kit")).to be true + expect(exist?("src")).to be true + expect(exist?("packages")).to be true + expect(exist?(File.join("src", "commons-collections4-4.4-src"))).to be true + expect(exist?(File.join("src", "commons-collections4-4.4-src", "pom.xml"))).to be true + expect(exist?(File.join("packages", "commons-collections", "commons-collections.tar.gz"))).to be true + + run_command("git rev-list --format=%B --max-count=1 HEAD") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/Inital sources added from archive/) end end diff --git a/spec/lib/coarse/main_spec.rb b/spec/lib/coarse/main_spec.rb deleted file mode 100644 index 8a869251..00000000 --- a/spec/lib/coarse/main_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require "spec_helper" - -describe "`tetra`", type: :aruba do - it "lists subcommands" do - run_simple("tetra") - - expect(stdout_from("tetra")).to include("Usage:") - - expect(stdout_from("tetra")).to include("init") - expect(stdout_from("tetra")).to include("dry-run") - expect(stdout_from("tetra")).to include("generate-kit") - expect(stdout_from("tetra")).to include("generate-script") - expect(stdout_from("tetra")).to include("generate-spec") - expect(stdout_from("tetra")).to include("generate-all") - expect(stdout_from("tetra")).to include("patch") - expect(stdout_from("tetra")).to include("move-jars-to-kit") - expect(stdout_from("tetra")).to include("get-pom") - end -end diff --git a/spec/lib/fine/project_spec.rb b/spec/lib/fine/project_spec.rb index 79831344..959f46c1 100644 --- a/spec/lib/fine/project_spec.rb +++ b/spec/lib/fine/project_spec.rb @@ -57,7 +57,7 @@ end it "returns the list of template files with bundles" do - expect(@project.template_files(true)).to include("bundled/apache-ant-1.9.7" => "kit") + expect(@project.template_files(true)).to include("bundled/apache-ant-1.10.12" => "kit") end end diff --git a/spec/main_spec.rb b/spec/main_spec.rb new file mode 100644 index 00000000..e3b1abf4 --- /dev/null +++ b/spec/main_spec.rb @@ -0,0 +1,21 @@ +require "spec_helper" + +RSpec.describe "`tetra`" do + + it "lists subcommands" do + run_command("tetra") + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_exit_status(0) + expect(last_command_started).to have_output(/Usage:/) + expect(last_command_started).to have_output(/init/) + expect(last_command_started).to have_output(/dry-run/) + expect(last_command_started).to have_output(/generate-kit/) + expect(last_command_started).to have_output(/generate-script/) + expect(last_command_started).to have_output(/generate-spec/) + expect(last_command_started).to have_output(/generate-all/) + expect(last_command_started).to have_output(/patch/) + expect(last_command_started).to have_output(/change-sources/) + expect(last_command_started).to have_output(/move-jars-to-kit/) + expect(last_command_started).to have_output(/get-pom/) + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d8a8d22c..70722e70 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,4 @@ -# encoding: UTF-8 - require "aruba/api" -require "aruba/reporting" require "tetra" @@ -15,10 +12,7 @@ end # set up aruba API - config.before(:each) do - restore_env - clean_current_dir - end + config.before(:each) { setup_aruba } end module Tetra diff --git a/tetra.gemspec b/tetra.gemspec index 11f6f0dd..b3d32929 100644 --- a/tetra.gemspec +++ b/tetra.gemspec @@ -24,16 +24,16 @@ Gem::Specification.new do |s| s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } s.require_paths = ["lib"] - s.add_development_dependency "aruba", "~> 0.6.2" - s.add_development_dependency "rake" - s.add_development_dependency "rspec" + s.add_development_dependency "aruba", "~> 2.1.0" + s.add_development_dependency "rake", "~> 13.0.6" + s.add_development_dependency "rspec", "~> 3.11.0" s.add_development_dependency "rubocop", "~> 1.35.1" - s.add_runtime_dependency "clamp" + s.add_runtime_dependency "clamp", "~> 1.3.2" s.add_runtime_dependency "erb", "~> 2.2.3" - s.add_runtime_dependency "json_pure" - s.add_runtime_dependency "open4" - s.add_runtime_dependency "rexml" - s.add_runtime_dependency "rubyzip", ">= 1.0" - s.add_runtime_dependency "text" + s.add_runtime_dependency "json_pure", "~> 2.6.2" + s.add_runtime_dependency "open4", "~> 1.3.4" + s.add_runtime_dependency "rexml", "~> 3.2.5" + s.add_runtime_dependency "rubyzip", "~> 2.3.2" + s.add_runtime_dependency "text", "~> 1.3.1" end