Sha256: 898771499e960f7dcdfcc43ef0c998d60f508597bfb612af77b3f294ecc2bb1b

Contents?: true

Size: 716 Bytes

Versions: 5

Compression:

Stored size: 716 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'spec_helper'

describe TTY::Shell::Question::Modifier, '#whitespace' do
  let(:string) { "  text\t \n  to\t   modify\r\n" }

  subject { described_class.whitespace modifier, string}

  context 'when stripping whitespace' do
    let(:modifier) { :trim }

    it { should == "text\t \n  to\t   modify" }
  end

  context 'when chomping whitespace' do
    let(:modifier) { :chomp }

    it { should == "  text\t \n  to\t   modify" }
  end

  context 'when capitalize' do
    let(:modifier) { :collapse }

    it { should == " text to modify " }
  end

  context 'when removing whitespace' do
    let(:modifier) { :remove }

    it { should == "texttomodify" }
  end
end # whitespace

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tty-0.0.11 spec/tty/shell/question/modifier/whitespace_spec.rb
tty-0.0.10 spec/tty/shell/question/modifier/whitespace_spec.rb
tty-0.0.9 spec/tty/shell/question/modifier/whitespace_spec.rb
tty-0.0.8 spec/tty/shell/question/modifier/whitespace_spec.rb
tty-0.0.7 spec/tty/shell/question/modifier/whitespace_spec.rb