This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe 'Hash#fetch_deep' do | |
input = {meal: 'musaka'} | |
order = { | |
dessert: { | |
type: 'cake', | |
variant: 'chocolate', | |
rating: 10, | |
"test" => { | |
t1: 15, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe '#fibonacci_like?' do | |
it { expect(fibonacci_like?([0, 1, 1, 2, 3, 5, 8, 13])).to be true } | |
it { expect(fibonacci_like?([2, 6, 8, 14, 22, 36])).to be true } | |
it { expect(fibonacci_like?([0, 1, 1, 2, 3, 8])).to be false } | |
it { expect(fibonacci_like?([2, -1, 1, 0, 1, 1 , 2, 3])).to be true } | |
it { expect(fibonacci_like?([0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 45, 50])).to be false } | |
it { expect(fibonacci_like?([0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89])).to be true } | |
it { expect(fibonacci_like?([0.1, 0.1, 0.2, 0.3, 0.5, 0.8, 1.3, 2.1, 3.4, 5.5, 8.9, 14.4])).to be true } | |
it { expect(fibonacci_like?([-1, -1, -2, -3, -5, -8, -13, -21, -34, -55, -89])).to be true } | |
it { expect(fibonacci_like?([0, -1, -1, -2, -3, -5, -8, -13, -21, -34, -45, -50])).to be false } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe CommandParser do | |
describe '#argument' do | |
it 'adds an argument' do | |
parser = CommandParser.new('rspec') | |
parser.argument('FILE') do |runner, value| | |
runner[:file] = value | |
end | |
command_runner = {} | |
parser.parse(command_runner, ['spec.rb']) |