Sha256: bc97cdea95ac031734da36516a45b5fad1f1c7242f9df9fc247a0c77a652f830

Contents?: true

Size: 736 Bytes

Versions: 6

Compression:

Stored size: 736 Bytes

Contents

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

require 'spec_helper'

describe TTY::Shell::Question::Modifier, '#apply_to' do
  let(:instance) { described_class.new modifiers }
  let(:string) { "Text to be modified"}

  subject { instance.apply_to string }

  context 'when no modifiers specified' do
    let(:modifiers) { [] }

    it { should == string }
  end

  context 'when modifiers specified' do
    let(:modifiers) { [:down, :capitalize] }

    it 'applies letter case modifications' do
      described_class.should_receive(:letter_case).with(modifiers, string)
      subject
    end

    it 'applies whitespace modifications' do
      described_class.should_receive(:whitespace).with(modifiers, string)
      subject
    end
  end
end # apply_to

Version data entries

6 entries across 6 versions & 1 rubygems

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