Sha256: 15e78c68e02c779e247d638c66fd65feffa7b68a57bdf801ee8f75d6458a9b1d

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'
require 'blazing/config'
require 'blazing/runner'
require 'grit'

describe 'blazing update' do

  before :each do
    setup_sandbox
    @production_url = 'user@host:/some/where'
    @staging_url = 'user@host:/some/where/else'

    @config = Blazing::Config.new
    @config.target :production, @production_url
    @config.target :staging, @staging_url, :default => true
    @runner = Blazing::Runner.new(@config)
  end

  after :each do
    teardown_sandbox
  end

  it 'generates the hook' do
    @shell_double = double('shell')#Blazing::Shell.new
    @target = @config.default_target
    @target.instance_variable_set('@shell', @shell_double)
    @shell_double.stub(:run)
    capture(:stdout) { @runner.exec('update') }
    File.exists?(Blazing::TMP_HOOK).should be true
  end

  it 'copies the hook to the targets repository and makes it exectuable' do
    @shell_double = double('shell')#Blazing::Shell.new
    @target = @config.default_target
    @target.instance_variable_set('@shell', @shell_double)

    @shell_double.should_receive(:run).once.with("scp /tmp/post-receive user@host:/some/where/else/.git/hooks/post-receive")
    @shell_double.should_receive(:run).once.with('ssh user@host chmod +x /some/where/else/.git/hooks/post-receive')
    capture(:stdout) { @runner.exec('update') }
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blazing-0.1.1 spec/blazing/integration/update_spec.rb
blazing-0.1.0 spec/blazing/integration/update_spec.rb
blazing-0.1.0.alpha6 spec/blazing/integration/update_spec.rb
blazing-0.1.0.alpha5 spec/blazing/integration/update_spec.rb
blazing-0.1.0.alpha4 spec/blazing/integration/update_spec.rb