Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment