Hi, i've recently started learning Ruby i spent a lot of time reading
and i've started working on Test-First Teaching exercise to test what i
have learned. But i got stuck on the performance monitor problem. I cant
seem to understand exactly what it's asking me to do.
Am i supposed to create a class Performance_monitor and creating an
object variable eleven_am ?
but when i called rake i cant even get pass the "takes about 0 seconds
to run an empty block".
some help on exactly what i'm supposed to be doing would be greatly
appreciated.
The trick -- and it is a trick -- is to create a method (not a class)
that calls a block and returns the amount of time that block took to
run. That's it. All the stuff in the test (including eleven_am) is
there to properly test that that simple method works right. It's hard
because it's easy
- Alex
···
On Fri, Feb 28, 2014 at 5:18 AM, Abinoam Jr. <abinoam@gmail.com> wrote:
Dear Tony Lee,
I also "need some help understanding" what you are trying to accomplish.
Could you point us the url or copy past the code do we can know what you are
talking about?
Best regards,
Abinoam Jr.
Em 28/02/2014 05:20, "Tony Lee" <lists@ruby-forum.com> escreveu:
Hi, i've recently started learning Ruby i spent a lot of time reading
and i've started working on Test-First Teaching exercise to test what i
have learned. But i got stuck on the performance monitor problem. I cant
seem to understand exactly what it's asking me to do.
Am i supposed to create a class Performance_monitor and creating an
object variable eleven_am ?
but when i called rake i cant even get pass the "takes about 0 seconds
to run an empty block".
some help on exactly what i'm supposed to be doing would be greatly
appreciated.
I also "need some help understanding" what you are trying to accomplish.
Could you point us the url or copy past the code do we can know what you
are talking about?
Best regards,
Abinoam Jr.
···
Em 28/02/2014 05:20, "Tony Lee" <lists@ruby-forum.com> escreveu:
Hi, i've recently started learning Ruby i spent a lot of time reading
and i've started working on Test-First Teaching exercise to test what i
have learned. But i got stuck on the performance monitor problem. I cant
seem to understand exactly what it's asking me to do.
Am i supposed to create a class Performance_monitor and creating an
object variable eleven_am ?
but when i called rake i cant even get pass the "takes about 0 seconds
to run an empty block".
some help on exactly what i'm supposed to be doing would be greatly
appreciated.
I got this error
takes about 1 second to run a block that sleeps for 1 second (FAILED -
1)
Failures:
1) Performance Monitor takes about 1 second to run a block that sleeps
for 1 second
Failure/Error: elapsed_time.should be_within(0.1).of(1)
expected 0.0 to be within 0.1 of 1
# ./06_performance_monitor/performance_monitor_spec.rb:37:in `block
(2 levels) in <top (required)>'
oh wait i'm stupid i did wrote the math wrong it should be
end_time - start_time
oops! anyway with that out of the way all i had to do was find the
average time for the last part
which is divide the current time by amount entered. just in case anyone
needs help with this in the future the answer is below
Time.at(0) returns a time object pointing to the beginning of Unix's
time epoch:
p Time::at(0)
1970-01-01 01:00:00 +0100
Carlo
···
Subject: Re: Need some help understanding
Date: sab 01 mar 14 01:52:44 +0100
--
* Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
* di parlare tanto di amore e di rettitudine? (Chuang-Tzu)
I got this error
takes about 1 second to run a block that sleeps for 1 second (FAILED -
1)
expected 0.0 to be within 0.1 of 1
What this tells you is that the test was expecting the result to be
between 0.9 and 1.1, and it's actually 0.0.
As the block is sleeping for one second, it seems that your
calculation of the time is wrong.
Take a look at the method you are using: