Sha256: c562a8112f4e76dea4489fe48f3aadda872cc46c69bdf60b31c1e1064bb1e94c

Contents?: true

Size: 1.56 KB

Versions: 6

Compression:

Stored size: 1.56 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)
    @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')
    @runner.exec('update')
  end

  it 'adds a git remote for each target' do
    @shell_double = double('shell', :run => true)
    @target = @config.default_target
    @target.instance_variable_set('@shell', @shell_double)
    @runner.exec('update')
    Grit::Repo.new(Dir.pwd).config['remote.production.url'].should == @production_url
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
blazing-0.2.7 spec/blazing/integration/update_spec.rb
blazing-0.2.6 spec/blazing/integration/update_spec.rb
blazing-0.2.5 spec/blazing/integration/update_spec.rb
blazing-0.2.4 spec/blazing/integration/update_spec.rb
blazing-0.2.3 spec/blazing/integration/update_spec.rb
blazing-0.2.2 spec/blazing/integration/update_spec.rb