TheOdinProject / ruby-exercises

MIT License
227 stars 1.09k forks source link

Specs: specs from numbers_exercises_spec have only one test case for some methods #76

Closed edimossilva closed 1 year ago

edimossilva commented 2 years ago

1. Description of the Feature Request: The methods add, subtract, multiply, divide and float_division have only one test case for them.

e.g. I suggested to a student to do the numbers exercise and the student did the following code:

def add(a, b)
  a = 1
  b = 2
  a + b
end

2. Acceptance Criteria:

e.g. Two specs for the sum method

   it 'adds two numbers' do
      expect(add(1, 2)).to eq(3)
      expect(add(4, 3)).to eq(7)
    end
rlmoser99 commented 2 years ago

Great idea! I have a few things that would need to be taken into account. I've assigned this to you, but please let us know if you have any questions.

In rspec, you only want 1 expect statement per text. In addition, you want to test a variety of inputs, like positive or negative numbers. So I would suggest your example above to be more like the following:

   it 'adds two positive numbers' do
      expect(add(1, 2)).to eq(3)
    end

     it 'adds two negative numbers' do
      expect(add(-4, -3)).to eq(-7)
    end

In addition these changes would need to also be done on the solutions branch, so in order to completely fix this issue, we would expect to see 2 different Pull Requests. One to the main branch and one to the solutions branch (with all passing tests).

ChargrilledChook commented 1 year ago

Hello @edimossilva , just checking in. Are you still interested in working on this? It looks like there were a few changes requested in your PR for this issue in #77

ChargrilledChook commented 1 year ago

I've merged the linked PR which has closed this issue, but it would still be good to make these changes to the other types of exercises too