Sha256: 37931e18e1778c7075c27979bb5f003279cbeeda46da3dbfef60e392872a741e

Contents?: true

Size: 887 Bytes

Versions: 126

Compression:

Stored size: 887 Bytes

Contents

# frozen_string_literal: true

RSpec.describe :strip_heredoc do
  link :strip_heredoc, from: :ree_string

  it 'empty string' do
    expect(strip_heredoc("")).to eq("")
  end

  it 'frozen string' do
    expect(strip_heredoc("").frozen?).to eq(true)
  end

  it 'string with no lines' do
    expect(strip_heredoc("x")).to eq("x")
    expect(strip_heredoc("    x")).to eq("x")
  end

  it 'heredoc with no margin' do
    expect(strip_heredoc("foo\nbar")).to eq("foo\nbar")
    expect(strip_heredoc("foo\n  bar")).to eq("foo\n  bar")
  end

  it 'regular indented heredoc' do
    expect(
      strip_heredoc(<<-EOS)
        foo
          bar
        baz
      EOS
    ).to eq("foo\n  bar\nbaz\n")
  end

  it 'regular indented heredoc with blank lines' do
    expect(
      strip_heredoc(<<-EOS)
        foo
          bar

        baz
      EOS
    ).to eq("foo\n  bar\n\nbaz\n")
  end
end

Version data entries

126 entries across 126 versions & 1 rubygems

Version Path
ree_lib-1.1.1 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.1.0 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.124 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.123 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.122 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.121 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.120 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.119 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.118 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.117 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.116 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.115 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.114 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.113 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.112 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.111 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.110 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.109 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.108 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb
ree_lib-1.0.107 lib/ree_lib/packages/ree_string/spec/ree_string/functions/strip_heredoc_spec.rb