Project

rspec-ohm

0.0
No commit activity in last 3 years
No release in over 3 years
RSpec matchers for Ohm
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.10

Runtime

~> 1.7
~> 2.0
~> 10.0
~> 3.1
 Project Readme

Rspec::Ohm

RSpec matchers for Ohm: Object Hash Mapper

Installation

Add this line to your application's Gemfile:

group :development, :test do
  gem 'rspec-ohm'
end

And then execute:

$ bundle

Or install it yourself as:

$ gem install rspec-ohm

Usage

Wire up:

RSpec.configure do |config|
  config.include RSpec::Ohm, type: :model
end

Matchers

class User < Ohm::Model

end

class Widget < Ohm::Model
  attribute   :name
  index       :name
  unique      :name

  set :users, :User
end

RSpec.describe Widget do
  it do
    expect(subject).to have_attribute(:name)
    expect(subject).to have_attribute(:name).with_index
  end

  it do
    expect(subject).to have_set_of(:users).with_index
    expect(subject).to have_set_of(:users).with_class(User)
  end

  it do
    expect(subject).to have_unique(:name)
  end
end

TODO

  1. More matchers!

Contributing

  1. Fork it ( https://github.com/jc00ke/rspec-ohm/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request