Sha256: 24ecd01c6aff33f21da883fc3a7af92ec7bec39858531725c45e9c7dc6a153f9

Contents?: true

Size: 1.88 KB

Versions: 1

Compression:

Stored size: 1.88 KB

Contents

require 'spec_helper'

describe "ey rollback" do
  given "integration"

  def command_to_run(opts)
    cmd = "rollback"
    cmd << " -e #{opts[:env]}" if opts[:env]
    cmd << " -a #{opts[:app]}" if opts[:app]
    cmd << " --verbose" if opts[:verbose]
    cmd
  end

  def verify_ran(scenario)
    @out.should match(/Rolling back.*#{scenario[:application]}.*#{scenario[:environment]}/)
    @err.should be_empty
    @ssh_commands.last.should match(/engineyard-serverside.*deploy rollback.*--app #{scenario[:application]}/)
  end

  it_should_behave_like "it takes an environment name"
  it_should_behave_like "it takes an app name"
  it_should_behave_like "it invokes engineyard-serverside"

  it "passes along the web server stack to engineyard-serverside" do
    api_scenario "one app, one environment"
    ey "rollback"
    @ssh_commands.last.should =~ /--stack nginx_mongrel/
  end

  context "--extra-deploy-hook-options" do
    before(:all) do
      api_scenario "one app, one environment"
    end

    def extra_deploy_hook_options
      if @ssh_commands.last =~ /--config (.*?)(?: -|$)/
        # the echo strips off the layer of shell escaping, leaving us
        # with pristine JSON
        JSON.parse `echo #{$1}`
      end
    end

    it "passes the extra configuration to engineyard-serverside" do
      ey "rollback --extra-deploy-hook-options some:stuff more:crap"
      extra_deploy_hook_options.should_not be_nil
      extra_deploy_hook_options['some'].should == 'stuff'
      extra_deploy_hook_options['more'].should == 'crap'
    end

    context "when ey.yml is present" do
      before do
        write_yaml({"environments" => {"giblets" => {"beer" => "stout"}}})
      end

      after { File.unlink("ey.yml") }

      it "overrides what's in ey.yml" do
        ey "rollback --extra-deploy-hook-options beer:esb"
        extra_deploy_hook_options['beer'].should == 'esb'
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
engineyard-1.3.1 spec/ey/rollback_spec.rb