Sha256: bc58946a625aa1e2ec379eeab7830fb3ee92b4d972e1c1a28188df46c4cf5ae5

Contents?: true

Size: 897 Bytes

Versions: 1

Compression:

Stored size: 897 Bytes

Contents

require 'spec_helper'

describe 'PGit::Helpers::Heredoc' do
  describe '.remove_front_spaces' do
    it 'should return the script, formatted nicely' do
      unprocessed = <<-HEREDOC
          function get_pgit_commands
          {
            if [ -z $2 ]; then
              COMPREPLY=(`pgit help -c`)
            else
              COMPREPLY=(`pgit help -c $2`)
            fi
          }
          complete -F get_pgit_commands pgit
      HEREDOC

      expected_script =
        "function get_pgit_commands\n" +
        "{\n" +
        "  if [ -z $2 ]; then\n" +
        "    COMPREPLY=(`pgit help -c`)\n" +
        "  else\n" +
        "    COMPREPLY=(`pgit help -c $2`)\n" +
        "  fi\n" +
        "}\n" +
        "complete -F get_pgit_commands pgit\n"
      script = PGit::Helpers::Heredoc.remove_front_spaces(unprocessed)

      expect(script).to eq expected_script
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pgit-1.0.0 spec/pgit/helpers/heredoc_spec.rb