RSPEC 4/7: RSPEC Practice 2: 03 Iteration.rb: Subwords + Doubler function

Hello fellow ruby learners!
Is anyone else having trouble passing the Rspec test for 03_iteration.rb? (Under Rspec: Rspec Practice 02 section in the Pre-course)
When run the ruby file in command line (ruby lib/03_iteration.rb), the output is correct but when i run the test through Rspec, the test fails:

Failures:

  1. #subwords can find a simple word
    Failure/Error: expect(words).to eq([“cat”])
   expected: ["cat"]
        got: nil
   (compared using ==)

Does anyone have any idea as to why this is happening? (or what I should search in google to debug this issue?)

Thank you :slight_smile:

I repeated your code and ran the spec for the subwords method. The results were all tests passing. Please make sure you are working on and saving the correct file. Great work on writing the method!

| => rspec spec/03_iteration_spec.rb:14
Run options: include {:locations=>{"./spec/03_iteration_spec.rb"=>[14]}}

  #subwords
  can find a simple word
  doesnt find spurious words
  can find words within words

Finished in 0.00724 seconds (files took 0.13635 seconds to load)
3 examples, 0 failures