Sha256: de5f64533593cdee8c814f3dafd399a567325418838972cf9c928c63e2016887

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 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

    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

2 entries across 2 versions & 1 rubygems

Version Path
forger-1.5.4 spec/lib/cli_spec.rb
forger-1.5.3 spec/lib/cli_spec.rb