File: remove_suffix_spec.rb

package info (click to toggle)
ruby-powerpack 0.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 352 kB
  • sloc: ruby: 799; makefile: 3
file content (21 lines) | stat: -rw-r--r-- 631 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'spec_helper'

describe 'String#remove_suffix' do
  it 'removes a suffix in a string' do
    expect('Ladies Night'.remove_suffix(' Night')).to eq('Ladies')
  end

  it 'returns the original string if the parameter is not a suffix' do
    expect('Ladies Night'.remove_suffix('Ladies')).to eq('Ladies Night')
  end
end

describe 'String#remove_suffix!' do
  it 'removes a suffix in a string' do
    expect('Ladies Night'.remove_suffix!(' Night')).to eq('Ladies')
  end

  it 'returns the original string if the parameter is not a suffix' do
    expect('Ladies Night'.remove_suffix!('Ladies')).to eq('Ladies Night')
  end
end