Sha256: 6ca91fcfc6bfc145bac84cfff51a568bc37d6ffa5032acb2f04fde58166733c2

Contents?: true

Size: 1.48 KB

Versions: 17

Compression:

Stored size: 1.48 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) }
    after { Mina::Configuration.instance.remove(:version_scheme) }

    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) }
      after { Mina::Configuration.instance.remove(:verbose) }

      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

17 entries across 17 versions & 1 rubygems

Version Path
mina-1.2.3 spec/lib/mina/helpers/internal_spec.rb
mina-1.2.2 spec/lib/mina/helpers/internal_spec.rb
mina-1.2.1 spec/lib/mina/helpers/internal_spec.rb
mina-1.2.0 spec/lib/mina/helpers/internal_spec.rb
mina-1.1.1 spec/lib/mina/helpers/internal_spec.rb
mina-1.1.0 spec/lib/mina/helpers/internal_spec.rb
mina-1.0.7 spec/lib/mina/helpers/internal_spec.rb
mina-1.0.6 spec/lib/mina/helpers/internal_spec.rb
mina-1.0.5 spec/lib/mina/helpers/internal_spec.rb
mina-1.0.4 spec/lib/mina/helpers/internal_spec.rb
mina-1.0.3 spec/lib/mina/helpers/internal_spec.rb
mina-1.0.2 spec/lib/mina/helpers/internal_spec.rb
mina-1.0.0 spec/lib/mina/helpers/internal_spec.rb
mina-1.0.0.rc2 spec/lib/mina/helpers/internal_spec.rb
mina-1.0.0.beta5 spec/lib/mina/helpers/internal_spec.rb
mina-1.0.0.beta4 spec/lib/mina/helpers/internal_spec.rb
mina-1.0.0.beta3 spec/lib/mina/helpers/internal_spec.rb