RSPEC2> 01_performance_monitor

"before do
**@**eleven_am = Time.parse(“2011-1-2 11:00:00”)
end


fake_time = @eleven_am
**allow(**Time).to receive(:now) { fake_time }"

The above (see bold text) includes lots of new syntax that was not previously discussed in the alpha course. I think I’ve figured everything out, but is there a particular reason that we need to set the time to 11:00 for performance monitoring?

Also, would like to ask, it is common in industry to get a rspec, and then be required to come up with a function to pass rspec without much guidance? Had to look at the solution to really know what I should be doing.

Edit: Everything between ** ** should be in bold. It seems the post does not display properly.

There is no particular reason why the time needs to be set to 11am specifically, however it needs to be set to something in order to use it as a reference for testing your method. It could be set to anything.

It is not common to have to write methods that pass RSpec tests without guidance. Once you are employed as a software engineer, you will generally write both the methods and tests yourself. However, it is very common in the industry to have to do a lot of Googling to understand unfamiliar syntax.

1 Like