makersacademy / problem-solving

For problem-solving during the PreCourse
6 stars 2 forks source link

Rspec error msg Chapter 4, Question 2 #146

Closed emmaalbury closed 6 years ago

emmaalbury commented 6 years ago

I've run Rspec on all my Chapter 4 quizzes and they all pass except Question 2. I get the error message "Failures: 1) Q2. Sum integers calculates 1 + 2 + 3 + ... + 250 and putses the result Failure/Error: expect { load "questions/question_2.rb" } .to output(/#{expected}$/).to_stdout

   expected block to output /31375
   $/ to stdout, but output "250\n"
   Diff:
   @@ -1,3 +1,2 @@
   -/31375
   -$/
   +250

 # ./spec/question_2_spec.rb:7:in `block (2 levels) in <top (required)>' "

I'm confused by this because I thought the desired output was 250. Which is what I'm getting. Why is it expecting "/31375"? Thank you.

m-rcd commented 6 years ago

Hi Emma, The desired output is actually 31375 which is what you get if you add up all numbers from 1 to 250! let me know if you need anything else :)

emmaalbury commented 6 years ago

Oh geez, I read the question wrong and wrote a a program that summed numbers to the total of 250. Teaches me for coding with late night brain fog. Thank you!