Sha256: adcfd6555b5501557f7e287bb337145719f2ba873fab2eb266402af0182721fe

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

describe Mina::Helpers::Internal do
  class DummyInternalHelper
    include Mina::DSL
    include Mina::Helpers::Internal
  end

  let(:helper) { DummyInternalHelper.new }

  describe '#deploy_script' do
    before do
      Mina::Configuration.instance.set(:deploy_script, 'data/deploy.sh.erb')
      Mina::Configuration.instance.set(:version_scheme, :sequence)
    end

    it 'returns whole script' do
      expect(helper.deploy_script {}).to_not be_empty
    end
  end

  describe '#erb' do
    before { Mina::Configuration.instance.set(:version_scheme, :sequence) }
    
    it 'returns whole script' do
      expect(helper.erb('data/deploy.sh.erb')).to_not be_empty
    end
  end

  describe '#echo_cmd' do
    context 'when not verbose' do
      it 'reuturns unedited code' do
        expect(helper.echo_cmd('ls -al')).to eq('ls -al')
      end
    end

    context 'when verbose' do
      before { Mina::Configuration.instance.set(:verbose, true) }

      it 'modifies code' do
        expect(helper.echo_cmd('ls -al')).to eq("echo \\$\\ ls\\ -al &&\nls -al")
      end

      it 'does not modify code if ignore_verbose is true' do
        expect(helper.echo_cmd('ls -al', ignore_verbose: true)).to eq('ls -al')
      end
    end
  end

  describe '#indent' do
    it 'indents code' do
      expect(helper.indent(4, 'ls -al')).to eq('    ls -al')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mina-1.0.0.beta2 spec/lib/mina/helpers/internal_spec.rb