Sha256: 4dd00ff061097868d89a4fb3a9af15a0b3e988aef320a6287c1bc96fba243017

Contents?: true

Size: 905 Bytes

Versions: 14

Compression:

Stored size: 905 Bytes

Contents

#          Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)

describe "String#unindent" do
  it "should remove indentation" do
    %(
      hello
        how
          are
        you
      doing
    ).ui.should == \
%(hello
  how
    are
  you
doing)
  end

  it 'should not break on a single line' do
    'word'.unindent.should == 'word'
  end

  it 'should find the first line with indentation' do
%(  hi
  there
    bob).ui.should == \
%(hi
there
  bob)
  end

  it 'should have destructive version' do
    str = %(  1\n    2\n  3)
    str.ui!
    str.should == %(1\n  2\n3)
  end

  it 'should use indentation from the last line if first line is not indented' do
    %(a{
      abc
    }).ui.should == %(a{\n  abc\n})
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
Pistos-ramaze-2009.06.12 spec/snippets/string/unindent.rb
manveru-ramaze-2009.07 spec/snippets/string/unindent.rb
ramaze-2011.12.28 spec/snippets/string/unindent.rb
ramaze-2011.10.23 spec/snippets/string/unindent.rb
ramaze-2011.07.25 spec/snippets/string/unindent.rb
ramaze-2011.01.30 spec/snippets/string/unindent.rb
ramaze-2011.01 spec/snippets/string/unindent.rb
ramaze-2010.06.18 spec/snippets/string/unindent.rb
ramaze-2010.04.04 spec/snippets/string/unindent.rb
ramaze-2010.04 spec/snippets/string/unindent.rb
ramaze-2010.03 spec/snippets/string/unindent.rb
ramaze-2010.01 spec/snippets/string/unindent.rb
ramaze-2009.10 spec/snippets/string/unindent.rb
ramaze-2009.07 spec/snippets/string/unindent.rb