Shoulda_deferred is a project mainly written in Ruby, based on the MIT license.
Always wanted to defer or postpone shoulda tests? Well, then this is the plugin for you! You can put an 'x' in front of any shoulda macro to run that test later.
= ShouldaDeferred
ShouldaDeferred is a take on a few shoulda extensions to defer context and should blocks, like xshould and xcontext.
NOTE: You will need to have Shoulda installed before you can use this plugin.
== Installation
ShouldaDeferred is available as plugin:
script/plugin install git://github.com/rudionrails/shoulda_deferred.git
You will need to manually require this plugin in your test helper. That is, because otherwise it would get automatically loaded in every environment.
require 'shoulda_deferred'
== Usage
You are able to put an 'x' before any shoulda macro or block in order to run it later.
xshould will postpone a single should statement. xcontext will delay that context and anything within the context block. You will see a " * DEFERRED... " message in the console for all deferred test. For xcontext, you will see a deferred message for all containing should blocks and subcontexts. This plugin also works for any other shoulda macro, like xshould_change, xshould_validate_presence_of, xshould_respond_with, etc.
=== Examples
xshould 'do something awesome' do flunk "defer" end
xcontext 'a deferred context' do should 'do something' do flunk "defer" end end
xcontext 'a deferred context' do context 'with another subcontext' do should 'do something awesome' do flunk "defer" end end end
context 'a regular context' do xcontext 'with a deferred subcontext' do should 'make me happy' do assert true end end
should 'assert true' do assert true # this will run! end end
xshould_respond_with :success
context 'a regular context' do xshould_render_template :index end
... and on and on and on and on...
== Known Issues None at the moment :-)
Copyright (c) 2009 Rudolf Schmidt, released under the MIT license.