Skip to content
This repository has been archived by the owner on Mar 8, 2019. It is now read-only.

xing/test-spec-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Test Spec Script

This script converts test files from test/spec to Rails 2.3+ standard test syntax.

github.com/xing/test-spec-script

Here’s an example to get an idea of the change:

before

context "A new pair of running shoes", ActiveRecord::TestCase do
  it "should be comfortable" do
    RunningShoes.new.should.be :comfortable
  end
end

after

class ANewPairOfRunningShoesTest < ActiveRecord::TestCase 
  test "should be comfortable" do
    assert(RunningShoes.new == :comfortable)
  end
end

Usage

The script accepts a directory path from which it will recursively search for *test.rb files to convert.

./convert-test-spec-to-test-unit ./test

You can use the --test or -toption to print to stdout instead of overwriting the files.

./convert-test-spec-to-test-unit ./test --test

There is a --strip-whitespaces or -s option that strips whitespaces from empty lines.

Credits

The script was initiated by Thomas Baustert and greatly extended by Stefan Kaes. Phillip Oertel provided a few lines as well.

License

The MIT License

Copyright © 2009 XING AG

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A script that converts tests from test/spec to Rails 2.3+ standard test syntax

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published