Sha256: 456c04b2b89be7bed5b664437a35e8bd68c6fdcd768acffd4b5601f21b10de81

Contents?: true

Size: 1.51 KB

Versions: 12

Compression:

Stored size: 1.51 KB

Contents

require "spec_helper"
require "foreman/cli"

describe "Foreman::CLI" do
  subject { Foreman::CLI.new }

  describe "start" do
    describe "with a non-existent Procfile" do
      it "prints an error" do
        mock_error(subject, "Procfile does not exist.") do
          dont_allow.instance_of(Foreman::Engine).start
          subject.start
        end
      end
    end

    describe "with a Procfile" do
      before(:each) { write_procfile }

      it "runs successfully" do
        dont_allow(subject).error
        mock.instance_of(Foreman::Engine).start({})
        subject.start
      end
    end
  end

  describe "export" do
    describe "with a non-existent Procfile" do
      it "prints an error" do
        mock_error(subject, "Procfile does not exist.") do
          dont_allow.instance_of(Foreman::Engine).export
          subject.export("testapp")
        end
      end
    end

    describe "with a Procfile" do
      before(:each) { write_procfile }

      describe "with an invalid formatter" do
        it "prints an error" do
          mock_error(subject, "Unknown export format: invalidformatter.") do
            subject.export("invalidformatter")
          end
        end
      end

      describe "with a valid config" do
        before(:each) { write_foreman_config("testapp") }

        it "runs successfully" do
          dont_allow(subject).error
          mock.instance_of(Foreman::Export::Upstart).export("/tmp/foo", {})
          subject.export("upstart", "/tmp/foo")
        end
      end
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
foreman-0.10.1 spec/foreman/cli_spec.rb
foreman-0.10.0 spec/foreman/cli_spec.rb
foreman-0.9.2 spec/foreman/cli_spec.rb
foreman-0.9.1 spec/foreman/cli_spec.rb
foreman-0.9.0 spec/foreman/cli_spec.rb
foreman-0.8.0 spec/foreman/cli_spec.rb
foreman-0.7.5 spec/foreman/cli_spec.rb
foreman-0.7.4 spec/foreman/cli_spec.rb
foreman-0.7.3 spec/foreman/cli_spec.rb
foreman-0.7.2 spec/foreman/cli_spec.rb
foreman-0.7.1 spec/foreman/cli_spec.rb
foreman-0.7.0 spec/foreman/cli_spec.rb