Posts Tagged ‘rspec’

RSpec’ing with Time.now

November 5th, 2008

I’m currently writing some RSpec tests that use Time.now.

I want my model to calculate a duration and store the future time in the database. I’ve already specced the calculation of the duration, but I also want to spec that everything gets saved correctly. Here’s my first spec:

it "should do stuff" do
  m = Model.create()
  m.expires_at.should eql(Time.now + some_value)
end

This fails.

RSpec 1.1 Released: Now Supports Rails 2.0

December 17th, 2007

The team behind RSpec, a Behavior-Driven Development based “testing” library, have announced the release of RSpec 1.1.0. This will be of particular interest to Rails 2.0 developers as support has now been added, along with interoperability with Test::Unit. RSpec 1.1 also includes a Rails tool called “RailsStory” that allows you write “user stories” that can be tested out on the fly.