File: ui_spec.rb

package info (click to toggle)
ruby-commander 4.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 360 kB
  • sloc: ruby: 1,971; makefile: 9
file content (32 lines) | stat: -rw-r--r-- 831 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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