Sha256: 6fbf2c0cc93fd73e701f513cf9f43fc731df7db7c34a4826d4f5b8da577a3c7f

Contents?: true

Size: 745 Bytes

Versions: 15

Compression:

Stored size: 745 Bytes

Contents

# encoding: utf-8

RSpec.describe TTY::Prompt::Question::Modifier, '#apply_to' do
  let(:string)   { "text   to   be    modified"}

  it "doesn't apply modifiers" do
    modifier = described_class.new([])
    expect(modifier.apply_to(string)).to eq(string)
  end

  it 'combines whitespace & letter case modifications' do
    modifiers = [:collapse, :capitalize]
    modifier = described_class.new(modifiers)
    modified = modifier.apply_to(string)
    expect(modified).to eq('Text to be modified')
  end

  it 'combines letter case & whitespace modifications' do
    modifiers = [:up, :collapse]
    modifier = described_class.new(modifiers)
    modified = modifier.apply_to(string)
    expect(modified).to eq('TEXT TO BE MODIFIED')
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
tty-prompt-0.17.2 spec/unit/question/modifier/apply_to_spec.rb
tty-prompt-0.17.1 spec/unit/question/modifier/apply_to_spec.rb
tty-prompt-0.17.0 spec/unit/question/modifier/apply_to_spec.rb
tty-prompt-0.12.0 spec/unit/question/modifier/apply_to_spec.rb
tty-prompt-0.11.0 spec/unit/question/modifier/apply_to_spec.rb
tty-prompt-0.10.1 spec/unit/question/modifier/apply_to_spec.rb
tty-prompt-0.10.0 spec/unit/question/modifier/apply_to_spec.rb
tty-prompt-0.9.0 spec/unit/question/modifier/apply_to_spec.rb
tty-prompt-0.8.0 spec/unit/question/modifier/apply_to_spec.rb
tty-prompt-0.7.1 spec/unit/question/modifier/apply_to_spec.rb
tty-prompt-0.7.0 spec/unit/question/modifier/apply_to_spec.rb
tty-prompt-0.6.0 spec/unit/question/modifier/apply_to_spec.rb
tty-prompt-0.5.0 spec/unit/question/modifier/apply_to_spec.rb
tty-prompt-0.4.0 spec/unit/question/modifier/apply_to_spec.rb
tty-prompt-0.3.0 spec/unit/question/modifier/apply_to_spec.rb