Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Uses ruby_scribe to convert your Test::Unit (+ shoulda) tests into RSpecs
branch: master

Merge pull request #4 from kirs/patch-1

Depend on activesupport >=3.0
latest commit fc1b6a3f82
Ben Hughes authored
Failed to load latest commit information.
bin Added a few more assertion handlers and configured emitter to not par…
lib Bumped version to 0.1.6 for new gem release.
spec
.gitignore Updated README with better documentation.
.rspec Added rspec options file.
.travis.yml Added travis-ci.
Gemfile Added Gemfile pointing to gem spec.
Gemfile.lock Added rake to dependencies and bumped ruby_transform dependency due t…
LICENSE
README.rdoc
Rakefile Added rake to dependencies and bumped ruby_transform dependency due t…
rspecify.gemspec Depend on activesupport >=3.0

README.rdoc

Build Status

RSpecify

Converting your tests from Test::Unit to RSpec is a drag when done by hand. This utility intelligently converts them to get you (hopefully) 90% of the way there.

In-Progress

NOTE: This gem is not essentially unusable and is being continually worked on - more of a proof of concept for now.

Command-Line Usage

The gem comes with a thor task that you can use to print out a converted version of any Ruby file containing Test::Unit Code.

$ rspecify cat test_project.rb

API Usage

This is built on the tree-walking base class RubyTransform::Transformer from the ruby_transform project. The principal transform, which is a composite of other more granular transforms, is +RSpecify::Transformer+. Here's how it can be used in conjunction with ruby_parser:

sexp = RubyParser.new.parse(File.read(path))
sexp = RSpecify::Transformer.new.transform(sexp)

emitter = RubyScribe::Emitter.new
emitter.methods_without_parenthesis += ["it", "describe", "context", "should", "should_not"]
emitter.emit(sexp)

Supported Test::Unit Assertion Transforms:

  • assert_equals

  • assert_not_equals

  • assert_not_nil

Example:

Original (Test::Unit):

class MyClass < ActiveSupport::TestCase
  def test_should_be_one
    assert_equals something, 1
  end

  def test_should_not_be_one
    assert_not_equals something, 1
  end

  def test_should_not_be_nil
    assert_not_nil something
  end
end

Transformed (RSpec):

describe MyClass do
  it "should be one" do
    something.should == 1
  end

  it "should not be one" do
    something.should_not == 1
  end

  it "should not be nil" do
    something.should_not be_nil
  end
end
Something went wrong with that request. Please try again.