Sha256: 378f6df4c1d82036e698307231a949f80c2aae426c5ca9064cb9377b5049a779

Contents?: true

Size: 1.45 KB

Versions: 6

Compression:

Stored size: 1.45 KB

Contents

describe Forger::CLI do
  before(:all) do
    @args = "--noop"
  end

  describe "forger" do
    it "create" do
      out = execute("exe/forger create server #{@args}")
      expect(out).to include("Creating EC2 instance")
    end

    it "ERB evaluates dotenv files" do
      out = execute("exe/forger create server #{@args}")
      user_data = IO.readlines("spec/fixtures/demo_project/tmp/user-data.txt")
      found = !user_data.select { |l| l =~ /test_key: test-key-value/ }.empty?
      expect(found).to be true
    end

    it "ami" do
      out = execute("exe/forger ami myimage #{@args}")
      expect(out).to include("Creating EC2 instance")
    end

    it "wait ami" do
      out = execute("exe/forger wait ami myimage")
      expect(out).to include("Waiting for")
    end

    it "clean ami" do
      out = execute("exe/forger clean ami imagebasename")
      expect(out).to include("Cleaning out old AMIs")
    end

    it "destroy" do
      out = execute("exe/forger destroy i-123")
      expect(out).to include("Destroying i-123")
    end

    commands = {
      "am" => "ami",
      "compile" => "--profile",
      "create -" =>  "--profile",
      "create" => "name",
      "create name --" => "--profile",
    }
    commands.each do |command, expected_word|
      it "completion #{command}" do
        out = execute("exe/forger completion #{command}")
        expect(out).to include(expected_word) # only checking for one word for simplicity
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
forger-2.0.4 spec/lib/cli_spec.rb
forger-2.0.3 spec/lib/cli_spec.rb
forger-2.0.2 spec/lib/cli_spec.rb
forger-2.0.1 spec/lib/cli_spec.rb
forger-2.0.0 spec/lib/cli_spec.rb
forger-1.6.0 spec/lib/cli_spec.rb