Deprecate (primarily) test code after a certain date, version, or other arbitrary condition is met.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
LICENSE
README.rdoc
Rakefile
VERSION.yml
deprecate.gemspec

README.rdoc

deprecate

Deprecate (primarily) test code after a certain date, version, or other arbitrary condition.

Examples

To use deprecate, simply require the code and put include Deprecate in whatever class you want to include it into (usually Test::Unit::TestCase). Then, in your tests (or whatever you include the module into) do something like:

# Deprecate after a certain date
deprecate "this feature", :after => "June 19, 2009" do
  assert "awesome"
end

# Deprecate if a proc's result is true
deprecate "this other feature", :when => lambda { this_conditional == true } do
  assert "failure!"
end

# Deprecate at a certain version
# Version is drawn from a VERSION constant in the current class, its parent class, or Kernel
# You can set it in test_helper/spec_helper like: VERSION = YourLib::VERSION
deprecate "that feature dude", :version => "1.0" do
  assert "this be deprecated"
end

# Deprecate if the version is greater than a number
deprecate "this thing", :version => greater_than("2.0") do
  assert "wat"
end

If a deprecation check fails it will produce an error like:

DeprecationError: `Doing stuff` is deprecated after 04/06/09 01:50:31.
DeprecationError: `Whatever` is deprecated after version 1.0.

Props

Spawned from a conversation with people on Twitter, finally finished and polished after @trevorturk's blog entry: almosteffortless.com/2009/04/05/time-bomb-test/

Copyright

Copyright © 2009 Jeremy McAnally. See LICENSE for details.