No commit activity in last 3 years
No release in over 3 years
custopm rspec mathcers
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
~> 2.0
 Project Readme

custom_rspec_matchers¶ ↑

This project contains a few custom rspec matchers that we have built to help us with our project.

Active Model Callback Examples¶ ↑

describe Duck do

it { should have_after_create_callback(:after_create_callback) }

it { should have_around_create_callback(:around_create_callback) } it { should have_before_create_callback(:before_create_callback) }

it { should have_after_save_callback(:after_save_callback) } it { should have_around_save_callback(:around_save_callback) } it { should have_before_save_callback(:before_save_callback) }

it { should have_after_update_callback(:after_update_callback) } it { should have_around_update_callback(:around_update_callback) } it { should have_before_update_callback(:before_update_callback) }

it { should have_after_validation_callback(:after_validation_callback) }

it { should have_before_validation_callback(:before_validation_callback) }

it { should have_after_validation_on_create_callback(:after_validation_on_create_callback) }
it { should have_before_validation_on_create_callback(:before_validation_on_create_callback) }

it { should have_after_validation_on_update_callback(:after_validation_on_update_callback) }
it { should have_before_validation_on_update_callback(:before_validation_on_update_callback) }

end

Action Controller Filter Examples¶ ↑

# checks for an after filter that does not specify the only or except option
it { should include_after_filter(:for_all_methods) }

# checks for an after filter that specifies the only option
it { should include_after_filter(:after_filter_only_create).only_on(:create) }

# checks for an after filter that specifies the only option with more than one methods
it { should include_after_filter(:after_filter_only_show_and_create).only_on([:show, :create]) }

# checks for an after filter with except specified for one method
it { should include_after_filter(:after_filter_except_create).except_on(:create) }

# checks for an after filter with except specified for more than one method
it { should include_after_filter(:after_filter_except_show_and_create).except_on([:show, :create]) }

# also works for before filter
it { should include_before_filter(:before_filter_only_show_and_create).only_on([:show, :create]) }
it { should include_before_filter(:before_filter_except_show_and_create).except_on([:show, :create]) }

Note on Patches/Pull Requests¶ ↑

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

Copyright © 2010 Kenny Ortmann. See LICENSE for details.