Sha256: e1470f061dff9a71e111896ee9e3fe005b820e73046afbf66dc9adb0fa090bd6

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe 'PGit::Helpers::StringExtensions' do
  describe '#letter?' do
    it 'should be case insensitive' do
      expect('h').to be_letter('h')
      expect('h').to be_letter('H')
    end

    it 'should not match when length is greater than 1' do
      expect('hh').not_to be_letter('h')
    end
  end

  describe '#index?' do
    describe 'without passing an arg' do
      it 'should tell us if the argument is a (normal person) index' do
        expect('1').to be_index
        expect('100').to be_index
        expect('0').not_to be_index
        expect('1.1').not_to be_index
      end
    end
  end

  describe '#yes?' do
    it 'returns true if letter is y and false if not' do
      expect('y').to be_yes
      expect('Y').to be_yes
      expect('2').not_to be_yes
    end
  end

  describe '#no?' do
    it 'returns false if letter is not and false if not' do
      expect('n').to be_no
      expect('N').to be_no
      expect('y').not_to be_no
    end
  end

  describe '#cancel?' do
    it 'returns true if letter is c and false if not' do
      expect('c').to be_cancel
      expect('C').to be_cancel
      expect('y').not_to be_cancel
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pgit-1.0.0 spec/pgit/helpers/string_extensions_spec.rb