Sha256: 5b7262561e0c8ddfb425526a6a143b9ede267537c0514443e84c861c7c8dec84

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

Class.new(Test::Unit::TestCase) do
  context 'util' do
    setup do
      assert_nothing_raised{ assert(@util = Gnip.util) }
    end

    should 'detect the home directory' do
      assert(test(?d, @util.homedir))
    end

    should 'unindent strings' do
      string = "\n\n  foobar\n  barfoo\n"
      unindented = @util.unindent(string)
      assert "\n\nfoobar\nbarfoo\n", unindented
      assert "\n\nfoobar\nbarfoo\n", @util.unindent!(string) 
      assert "\n\nfoobar\nbarfoo\n", string
    end

    should 'indent strings' do
      string = "\n\n  foobar\n  barfoo\n"
      indented = @util.indent(string, 1)
      assert "\n\n foobar\n barfoo\n", indented
      indented = @util.indent(string, 3)
      assert "\n\n   foobar\n   barfoo\n", indented
      indented = @util.indent!(string, 3)
      assert "\n\n   foobar\n   barfoo\n", indented
      assert "\n\n   foobar\n   barfoo\n", string
    end

    should 'inline strings' do
      string = "\n\n  foobar\n  barfoo\n"
      inlined = @util.inline(string)
      assert "foobar barfoo", inlined
      inlined = @util.inline!(string)
      assert "foobar barfoo", inlined
      assert "foobar barfoo", string
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
gnip-gnip-1.1.1 test/unit/util.rb
gnip-0.4.2 test/unit/util.rb
gnip-1.0.0 test/unit/util.rb
gnip-1.1.1 test/unit/util.rb
gnip-1.1.2 test/unit/util.rb