29 May '12, 1pm

Clojure: Freezing Time in expectations

The current version of expectations (1.4.3) contains support for freezing time within an expectations scenario . I already put this information out in a previous blog entry , and I'm going to use the same examples here. The following code is a test I was working on at work: (scenario (handle-fill (build PartialFill)) (expect {:px 10 :size 33 :time 1335758400000} (first @fills))) The test builds a PartialFill domain object, and passes it to handle-fill. The handle-fill fn converts the domain object to a map and conj's the new map onto the fills vector (which is an atom). The above test would fail due to the time not being frozen, and the traditional way to deal with this issue was to change the test to use (in ..) and ignore the :time key-value pair. The following code would have resulted in a passing test: (scenario (handle-fill (build PartialFill)) (expect {:px 10 :size 3...

Full article: http://blog.jayfields.com/2012/05/clojure-freezing-time-i...

Tweets

Clojure: expectations & with-redefs

blog.jayfields.com 05 Jun '12, 1pm

In general, when I'm writing tests, the pure functions end up as bare expects and the impure functions end up as scenarios...

Clojure: expectations, colorized

Clojure: expectations, colorized

blog.jayfields.com 24 May '12, 1pm

The current version of expectations (1.4.3) prints colorized results by default on non-windows boxes. The following screen...

I just learned you can provide Label text for f...

api.rubyonrails.org 30 May '12, 5pm

Returns a label tag tailored for labelling an input field for a specified attribute (identified by method ) on an object a...

[blog] Time is short, ... let's use our time for things that really matter! Have a great week, everyone!

[blog] Time is short, ... let's use our time fo...

oureverydaythings.com 04 Jun '12, 1am

Recently I read a eulogy written by a husband of a 39-year-old woman who died of cancer not too long ago. They had three s...

Turing and the Test of Time

spectrum.ieee.org 03 Jun '12, 2am

The centenary of Alan Turing’s birth is being greeted by an extraordinary response, not only in mathematical and scientifi...

What trouble is brewing Down Under?

What trouble is brewing Down Under?

worldtempus.com 31 May '12, 10am

When a watchmaker becomes an independent watchmaker-repairer, he or she usually does that for the love of the craft, and i...

Turing and the Test of Time

spectrum.ieee.org 03 Jun '12, 2am

The centenary of Alan Turing’s birth is being greeted by an extraordinary response, not only in mathematical and scientifi...

Clojure: name function

blog.jayfields.com 11 Jun '12, 2pm

The 'name' function is a clojure function that returns the string for a keyword, symbol, or string. name - function Usage:...