Skip to content

Instantly share code, notes, and snippets.

@eduardopoleo
Created February 1, 2019 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eduardopoleo/44097f3a6ec44e9069c027dcb4841aec to your computer and use it in GitHub Desktop.
Save eduardopoleo/44097f3a6ec44e9069c027dcb4841aec to your computer and use it in GitHub Desktop.
def add_two(a, b)
a.to_i + b.to_i
end
add_two(1, 1)
describe '#add_two' do
context 'when I add two positive numbers' do
it 'returns the sum of the numbers' do
expect(add_two(1, 1)).to eq(2)
end
end
context 'when the inputs are strings' do
it 'returns the sum of the numbers as if they were integers' do
expect(add_two('1', '1')).to eq(2)
end
end
end
describe UsersController do
context 'when the params are valid' do
it 'create the user' do
post user: { name: 'eduardo', email: 'eduardo@gmakil.com', password: 'password', age: 18}
expect(User.count).to eq(1)
end
it 'redirects to the homepage' do
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment