Sha256: 8c68bcf3a902ac748f71de61883e8c93730250b7f67e21c084adf0a3917a72f5

Contents?: true

Size: 831 Bytes

Versions: 2

Compression:

Stored size: 831 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Commander::UI do
  include Commander::Methods

  describe '.replace_tokens' do
    it 'should replace tokens within a string, with hash values' do
      result = Commander::UI.replace_tokens 'Welcome :name, enjoy your :object', name: 'TJ', object: 'cookie'
      expect(result).to eq('Welcome TJ, enjoy your cookie')
    end
  end

  describe 'progress' do
    it 'should not die on an empty list' do
      exception = false
      begin
        progress([]) {}
      rescue StandardError
        exception = true
      end
      expect(exception).not_to be true
    end
  end

  describe '.available_editor' do
    it 'should not fail on available editors with shell arguments' do
      expect(Commander::UI.available_editor('sh -c')).to eq('sh -c')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
commander-5.0.0 spec/ui_spec.rb
commander-4.6.0 spec/ui_spec.rb