Skip to content

Instantly share code, notes, and snippets.

@Kuz-man
Last active Oct 26, 2016
Embed
What would you like to do?
Challenge 2
describe '#ordinalize' do
it 'can ordinalize' do
expect(ordinalize(1)).to eq '1st'
expect(ordinalize(5)).to eq '5th'
expect(ordinalize(12)).to eq '12th'
expect(ordinalize(-11)).to eq '-11th'
expect(ordinalize(-13)).to eq '-13th'
expect(ordinalize(1)).to eq '1st'
expect(ordinalize(2)).to eq '2nd'
expect(ordinalize(3)).to eq '3rd'
expect(ordinalize(4)).to eq '4th'
expect(ordinalize(5)).to eq '5th'
expect(ordinalize(6)).to eq '6th'
expect(ordinalize(7)).to eq '7th'
expect(ordinalize(10)).to eq '10th'
expect(ordinalize(11)).to eq '11th'
expect(ordinalize(-2)).to eq '-2nd'
expect(ordinalize(-3)).to eq '-3rd'
expect(ordinalize(-4)).to eq '-4th'
expect(ordinalize(-5)).to eq '-5th'
expect(ordinalize(-6)).to eq '-6th'
expect(ordinalize(-7)).to eq '-7th'
expect(ordinalize(-10)).to eq '-10th'
expect(ordinalize(-11)).to eq '-11th'
expect(ordinalize(12)).to eq '12th'
expect(ordinalize(13)).to eq '13th'
expect(ordinalize(14)).to eq '14th'
expect(ordinalize(20)).to eq '20th'
expect(ordinalize(21)).to eq '21st'
expect(ordinalize(31)).to eq '31st'
expect(ordinalize(222)).to eq '222nd'
expect(ordinalize(333)).to eq '333rd'
expect(ordinalize(4444)).to eq '4444th'
expect(ordinalize(1000)).to eq '1000th'
expect(ordinalize(121)).to eq '121st'
expect(ordinalize(-91)).to eq '-91st'
expect(ordinalize(-1)).to eq '-1st'
expect(ordinalize(-12)).to eq '-12th'
expect(ordinalize(-33)).to eq '-33rd'
expect(ordinalize(-13)).to eq '-13th'
expect(ordinalize(-4235)).to eq '-4235th'
expect(ordinalize(-4210)).to eq '-4210th'
expect(ordinalize(-1)).to eq '-1st'
expect(ordinalize(-321411)).to eq '-321411th'
expect(ordinalize(4215112)).to eq '4215112th'
expect(ordinalize(-51113)).to eq '-51113th'
expect(ordinalize(5112213)).to eq '5112213th'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment