Sha256: d434ba401c79aac6d9bff0224d3659d7b090254717330f9a5fb10635d6c7b7a1

Contents?: true

Size: 1.5 KB

Versions: 77

Compression:

Stored size: 1.5 KB

Contents

require "spec_helper"

module CF
  module App
    describe Restart do
      let(:restart_command) { CF::App::Restart.new(Mothership.commands[:restart]) }
      let(:inputs) { {:apps => [app]} }
      let(:app) { build(:app, :command => "rails s") }

      before do
        restart_command.input = Mothership::Inputs.new(nil, restart_command, inputs, {}, {})
        app.stub(:update!)
      end

      it "restarts the application" do
        restart_command.should_receive(:invoke).with(:stop, anything) do
          restart_command.should_receive(:invoke).with(:start, anything)
        end
        restart_command.restart
      end

      it "does not change the command if we do not pass the command argument" do
        restart_command.stub(:invoke).with(:start, anything)
        restart_command.stub(:invoke).with(:stop, anything)
        restart_command.restart
        app.command.should == "rails s"
      end

      context "when passing in a new start command" do
        let(:inputs) { {:apps => [app], :command => 'rake db:migrate'} }

        before do
          restart_command.stub(:invoke).with(:stop, anything)
          restart_command.input = Mothership::Inputs.new(nil, restart_command, inputs, {}, {})
        end

        it "updates the start command" do
          app.should_receive(:update!) do
            restart_command.should_receive(:invoke).with(:start, anything)
          end
          restart_command.restart
          app.command.should == "rake db:migrate"
        end
      end
    end
  end
end

Version data entries

77 entries across 77 versions & 2 rubygems

Version Path
cf-5.4.7 spec/cf/cli/app/restart_spec.rb
cf-5.4.7.rc1 spec/cf/cli/app/restart_spec.rb
cf-5.4.5 spec/cf/cli/app/restart_spec.rb
cf-5.4.4 spec/cf/cli/app/restart_spec.rb
trucker-cli-0.0.3 spec/cf/cli/app/restart_spec.rb
cf-5.4.3 spec/cf/cli/app/restart_spec.rb
cf-5.4.2 spec/cf/cli/app/restart_spec.rb
trucker-cli-0.0.2 spec/cf/cli/app/restart_spec.rb
trucker-cli-0.0.1 spec/cf/cli/app/restart_spec.rb
cf-5.4.1 spec/cf/cli/app/restart_spec.rb
cf-5.4.1.rc1 spec/cf/cli/app/restart_spec.rb
cf-5.4.0 spec/cf/cli/app/restart_spec.rb
cf-5.3.1 spec/cf/cli/app/restart_spec.rb
cf-5.3.0 spec/cf/cli/app/restart_spec.rb
cf-5.2.2 spec/cf/cli/app/restart_spec.rb
cf-5.2.1.rc15 spec/cf/cli/app/restart_spec.rb
cf-5.2.1.rc14 spec/cf/cli/app/restart_spec.rb
cf-5.2.1.rc13 spec/cf/cli/app/restart_spec.rb
cf-5.2.1.rc12 spec/cf/cli/app/restart_spec.rb
cf-5.2.1.rc11 spec/cf/cli/app/restart_spec.rb