turingschool-examples / ruby-exercises

A collection of exercises to practice various aspects of Ruby
MIT License
237 stars 766 forks source link

Incorrect test method in `initialize/spec/groundhog_spec.rb` on line 14 #128

Closed brandenge closed 1 year ago

brandenge commented 1 year ago

Line 14 needs to change the test assertion method to be eq, rather than be.

So: expect(gabby.name).to be("Gabby")

should be changed to:

expect(gabby.name).to eq("Gabby")

Otherwise, you get the following error message:

Failures:

  1) Groundhog has a name
     Failure/Error: expect(gabby.name).to be("Gabby")

       expected #<String:1300> => "Gabby"
            got #<String:1320> => "Gabby"

       Compared using equal?, which compares object identity,
       but expected and actual are not the same object. Use
       `expect(actual).to eq(expected)` if you don't care about
       object identity in this example.
   \# ./groundhog_spec.rb:14:in `block (2 levels) in <top (required)>'