Sergey Potapov

A word from rustacean, rubist and linuxoid.

RSpec Matchers for DataMapper (Dm-rspec)

I am currently developing a number of RSpec matchers for DataMapper models testing. You can try it. Just add the next in your Gemfile under test group:

gem 'dm-rspec'

And run bundle install to install new gems.

The main idea is to provide the same (almost the same) interface which Shoulda provides to test ActiveRecord models.

At the moment I implemented the next matchers:

  • belong_to
  • have_many
  • have_many_and_belong_to
  • have_property
  • have(n).errors_on(:property)
  • have_many(:association).trough(:another_association)
  • validate_presence_of(:property)
  • validate_uniqueness_of(:property)
  • validate_format_of(:property).with(/regexp/)

More information you can find on DataMapper RSpec github page.

Anyone is welcome to join me in developing:)