Sha256: 5e7bbf6454f995818c502d47e6e2821668473e0509322c785f8ae58535bd376d

Contents?: true

Size: 875 Bytes

Versions: 6

Compression:

Stored size: 875 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
      allow(described_class).to receive(:letter_case)
      subject
      expect(described_class).to have_received(:letter_case).
        with(modifiers, string)
    end

    it 'applies whitespace modifications' do
      allow(described_class).to receive(:whitespace)
      subject
      expect(described_class).to have_received(:whitespace).
        with(modifiers, string)
    end
  end
end # apply_to

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tty-0.2.1 spec/tty/shell/question/modifier/apply_to_spec.rb
tty-0.2.0 spec/tty/shell/question/modifier/apply_to_spec.rb
tty-0.1.3 spec/tty/shell/question/modifier/apply_to_spec.rb
tty-0.1.2 spec/tty/shell/question/modifier/apply_to_spec.rb
tty-0.1.1 spec/tty/shell/question/modifier/apply_to_spec.rb
tty-0.1.0 spec/tty/shell/question/modifier/apply_to_spec.rb