Sha256: f714b8284ddfe9a08764c0dabe3a7f9e333d4378183307c9b3a028543a61bee9

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

require File.join(File.dirname(__FILE__), '../../test_helper')

describe HammerCLI::Help::List do
  describe '#build_string' do
    let(:first_item)  { [:first,   'This is first line'] }
    let(:second_item) { [:second,  'This is second line'] }
    let(:list) { HammerCLI::Help::List.new([first_item, second_item]) }
    let(:item_with_options) { [:third, 'This is bold item', { bold: true }] }

    it 'builds string' do
      _(list.build_string).must_equal [
        'first               This is first line',
        'second              This is second line',
        ''
      ].join("\n")
    end

    it 'ensures that item options are used' do
      list = HammerCLI::Help::List.new([first_item, second_item, item_with_options])
      changed_item = HighLine.color('third', :bold)
      _(list.build_string).must_equal [
        'first               This is first line',
        'second              This is second line',
        "#{changed_item}               This is bold item",
        ''
      ].join("\n")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hammer_cli-3.13.0 test/unit/help/definition/list_test.rb
hammer_cli-3.12.0 test/unit/help/definition/list_test.rb
hammer_cli-3.10.0 test/unit/help/definition/list_test.rb
hammer_cli-3.9.0 test/unit/help/definition/list_test.rb
hammer_cli-3.8.0 test/unit/help/definition/list_test.rb