I am just looking for any guidance possible here - at least to be pointed in the right direction. I have been moving through the curriculum at a decent pace and - for the most part - understanding what is being asked of me to complete all the way through and seeing where it was I should have learned about it. However, having finished RSPEC 3 exercises with not many issues and am now on RSPEC 4 exercises and, to some extent, I just feel like I hit a conceptual wall. For example, I am having great difficulty even understanding what is really being asked for in temperature_object specs. In fact, even peaking at the solutions is not much help - which makes me all the more anxious. Is this part of the training, to just spin wheels until we understand? If anyone who struggled to understand what was being asked and then figured out what was being asked could shed some light on this, it would be much appreciated. I have been pouring over the Class section notes in hopes of some help, but it really comes down to - at least I think it does for me at this point - in not being able to interpret what is being asked from the spec…
I apologize for the open-ended nature of my question, but I am not even understanding well enough at this point to fashion a more precise question. I can see we need to create some factory methods for constructing temperatures, some instance methods and some options hashes (whatever that is) - all for the purpose of converting Celsius to Fahrenheit and vice versa. I hate to think I am the only one that hit a wall when arriving at RSPEC 4, so I am hoping to hear from someone who hit the wall and climbed over it so to speak. This material seems important…
I know this post is pretty old, but I’m having the exact same issue understanding what’s going on in this particular problem. Anyone available to help?
I’m glad someone else is speaking up…I’ve been having the same issue, and asking the same questions, for about two months now…and not really getting any good answers, and just soldiering on. I’m getting pretty demoralized at this point. If the full-time program is as unsupportive and poorly organized as the Alpha curriculum, I’m not sure if App Academy is a place I want to be.
Let’s walk through this from the beginning.
When we say
describe Temperature we’re saying we’re going to start describing some expected behavior for the Temperature class.
And then more specifically, we say it can be constructed with an options hash. This means the Temperature class’s initialize method should take an options hash (it’s really just a regular old hash) as an argument. In this case, it looks like we’re going to expect a hash with keys of :f and/or :c which correspond to temperatures in F and C. So we can save those value(s), as instance variable(s) on this new Temperature object.
Then in the line
Temperature.new(:f => 50).in_fahrenheit).to eq(50), we’re saying that if we call the method
#in_fahrenheit on that new Temperature instance, it should return 50. So in that method we’re probably going to have to look at what information we have available on that Temperature instance (ie its instance variables), and given that information, return the temperature in Fahrenheit. Same thing for the
The next set of specs that initialize a Temperature instance with a :c key in the options hash is just testing that your initialize method can accept either :f or :c.
Now we’re asking you to write some factory methods:
The first method we’re calling is a class method, Temperature::from_celsius.
Since we’re calling the instance method #in_celsius on the return value, we can tell that it should be returning an instance of Temperature. We’re also expecting that the #in_celsius should return 50 (the same value we gave to ::from_celsius. So when we call Temperature.from_celsius(some_number), that should return a new instance of Temperature, with its celsius temperature saved as some_number. And how do you make a new Temperature instance? You give it an options hash with :f pointing to the Fahrenheit temp, and/or :c pointing to the Celsius temp.
Temperature ::from_fahrenheit should be very similar.
I felt the same way at first, but I have found the TAs to be super helpful recently on the boards. I definitely take it to DMs if I really need that extra guidance (which I do…a lot)!
Feel free to DM me as well - I love working through tough problems with another person.