Created
October 11, 2016 18:29
-
-
Save lkrych/3b3c006e2910b6472220bb0259947d54 to your computer and use it in GitHub Desktop.
RSpec for factorial function
This file contains hidden or 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
require_relative '../factorial.rb' | |
describe "Test the factorial function" do | |
it 'returns the right answer for 5' do | |
expect(factorial(5)).to eq(120) | |
end | |
it 'returns the right answer for 10' do | |
expect(factorial(10)).to eq(3628800) | |
end | |
it 'returns an error message for -5' do | |
expect(factorial(-5)).to eq(nil) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment