The project is in a healthy, maintained state
A gem to convert Minitest unit tests to spec style
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

~> 1.0
~> 3.3
~> 0.6
 Project Readme

MinitestSpecConverter

This gem helps to convert code in minitest or mixed style to minitest spec style.

Before conversion:

class TestMeme < Minitest::Test
  def setup
    @meme = Meme.new
  end

  def test_that_kitty_can_eat
    assert_equal "OHAI!", @meme.i_can_has_cheezburger?
  end

  def test_that_it_will_not_blend
    refute_match /^no/i, @meme.will_it_blend?
  end
end

After conversion:

describe Meme do
  before do
    @meme = Meme.new
  end

  describe "when asked about cheeseburgers" do
    it "must respond positively" do
      _(@meme.i_can_has_cheezburger?).must_equal("OHAI!")
    end
  end

  describe "when asked about blending possibilities" do
    it "won't say no" do
      _(@meme.will_it_blend?).wont_match(/^no/i)
    end
  end
end

Installation

gem install minitest-spec-converter

Usage

minitest-spec-converter ./path/to/your/test/directory

It will format all the minitest test files in the directory to the minitest spec format. Directory argument is optional and defaults to the ./test.

it is recommended to run rubocop --fix after running the converter to fix the formatting issues.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/DrShnitzel/minitest_spec_converter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the MinitestSpecConverter project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.