Sha256: bfb53476f5f7b7fb3880927db4e960ebce821252b475261344ff8d76fa0d80b9

Contents?: true

Size: 746 Bytes

Versions: 1

Compression:

Stored size: 746 Bytes

Contents

require 'spec_helper'

require 'gerrit/cli/util'

describe Gerrit::Cli::Util do
  describe '.render_table' do
    it 'should return an empty string if supplied with now rows' do
      Gerrit::Cli::Util.render_table([]).should == ''
    end

    it 'should raise an error if column counts do not match' do
      rows = [[1], [1, 2]]
      expect do
        Gerrit::Cli::Util.render_table(rows)
      end.to raise_error(/column mismatch/i)
    end

    it 'should pad each column to the max. length element' do
      rows = [["a", "bb", "ccc"],
              ["aa", "bbb", "cccc"]]
      table = Gerrit::Cli::Util.render_table(rows)
      expected = "a  bb  ccc \n" \
               + "aa bbb cccc"
      table.should == expected
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gerrit-cli-0.0.1 spec/util_spec.rb