No commit activity in last 3 years
No release in over 3 years
This gem is meant to be use with mongoid-rpsec, altought it works by itself. Syntax is the same as shoulda-callback-matchers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 13.0, >= 13.0.3
~> 6.0.4
~> 3.10
~> 1.13.0
~> 1.11, >= 1.11.1
~> 0.21.2

Runtime

~> 6.1.3.1
~> 7.2, >= 7.2.2
 Project Readme

Mongoid::Rspec::Callbacks

RSpec Linter Gem Version Docs Maintainability Test Coverage Known Vulnerabilities

http://rubygems.org/gems/mongoid-rspec-callbacks

RSpec Callbacks matchers for Mongoid 7.x and ActiveSupport 6.x

This gem is meant to be use with mongoid-rpsec, altought it works by itself.

Syntax is the same as shoulda-callback-matchers.

By now, only on option is supported.

Installation

Add to your Gemfile

gem 'mongoid-rspec-callbacks'

Drop in existing or dedicated support file in spec/support (spec/support/mongoid.rb)

RSpec.configure do |configuration|
  configuration.include Mongoid::Matchers
end

Callbacks Matchers

describe User do
  it { should callback(:method).before(:save) }
  it { should callback(:method).after(:save) }
  it { should callback(:method, :method2).before(:validation) }
  it { should callback(:method).after(:validation).on(:create) }
end

Set Callbacks Matchers

describe User do
  it { is_expected.to set_callback(:save, :arround)  }
  it { is_expected.to set_callback(:validation, :after)  }
end

Association Callbacks Matchers

describe User do
  it { is_expected.to association_callback(:has_many,
                                           :add,
                                           :after,
                                           :send_email_to_subscribers)  }
end

delegate Matchers

describe User do
  it { is_expected.to delegate(:name).to(:author) }
  it { is_expected.to delegate(:day).to(:created_at).with_prefix(:date) }
end