Sha256: 710001de776b3a48d899d4d60e0487e96fae2183c58b7c6dce1399dd070b6eb8

Contents?: true

Size: 549 Bytes

Versions: 26

Compression:

Stored size: 549 Bytes

Contents

require 'spec_helper'

describe 'String#strip_margin' do
  it 'strips margin on every line of string' do
    code = <<-END
      |def test
      |  some_method
      |  other_method
      |end
    END

    expect(code.strip_margin('|'))
      .to eq("def test\n  some_method\n  other_method\nend\n")
  end

  it 'strips special characters margin from every line' do
    code = <<-END
      {{1}}def test
      {{1}}  some_method
      {{1}}end
    END

    expect(code.strip_margin('{{1}}'))
      .to eq("def test\n  some_method\nend\n")
  end
end

Version data entries

26 entries across 23 versions & 6 rubygems

Version Path
powerpack-0.1.3 spec/powerpack/string/strip_margin_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/strip_margin_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/strip_margin_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/strip_margin_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/strip_margin_spec.rb
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.1/spec/powerpack/string/strip_margin_spec.rb
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/strip_margin_spec.rb
dirwatch-0.0.8 vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.1/spec/powerpack/string/strip_margin_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/powerpack-0.1.2/spec/powerpack/string/strip_margin_spec.rb
powerpack-0.1.2 spec/powerpack/string/strip_margin_spec.rb
dirwatch-0.0.6 vendor/bundle/ruby/2.3.0/gems/powerpack-0.1.1/spec/powerpack/string/strip_margin_spec.rb
dirwatch-0.0.5 vendor/bundle/ruby/2.3.0/gems/powerpack-0.1.1/spec/powerpack/string/strip_margin_spec.rb
dirwatch-0.0.4 vendor/bundle/ruby/2.3.0/gems/powerpack-0.1.1/spec/powerpack/string/strip_margin_spec.rb
dirwatch-0.0.3 vendor/bundle/ruby/2.3.0/gems/powerpack-0.1.1/spec/powerpack/string/strip_margin_spec.rb
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/powerpack-0.1.1/spec/powerpack/string/strip_margin_spec.rb
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/powerpack-0.1.1/spec/powerpack/string/strip_margin_spec.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/powerpack-0.1.1/spec/powerpack/string/strip_margin_spec.rb
rubyjobbuilderdsl-0.0.2 vendor/bundle/ruby/2.1.0/gems/powerpack-0.0.9/spec/powerpack/string/strip_margin_spec.rb
rubyjobbuilderdsl-0.0.1 vendor/bundle/ruby/2.1.0/gems/powerpack-0.0.9/spec/powerpack/string/strip_margin_spec.rb
powerpack-0.1.1 spec/powerpack/string/strip_margin_spec.rb