0.0
No commit activity in last 3 years
No release in over 3 years
Shoulda style syntax for minitest test::unit. Contexts are not yet supported, but you can use `should "do something"` instead of those `pesky_underscored_test_names`. Please see documentation for more information.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Minitest Should Build Status Dependency Status

minitest_should allows you to write unit tests with shoulda style context syntax for minitest.


Usage

When writing your mini-tests, inherit from Minitest::Should::TestCase.

gem "minitest"

require "minitest/autorun"
require "minitest/should"


# instead of this
class TestWithUnderscores < Minitest::Unit::TestCase
  
  def test_should_just_work
    assert true
  end
  
  def test_something_else_should_be_nothing
    @something = "nothing"
    assert_equal "nothing", @something
  end
  
end

# use this!
class TestWithShould < Minitest::Should::TestCase
  
  should "just work" do
    assert true
  end
  
  context "Something else" do
    
    setup do
      @something = "nothing"
    end
    
    should "be nothing" do
      assert_equal "nothing", @something
    end
    
  end
  
end

Installation

As usual, just use the gem install command:

(sudo) gem install minitest_should

Or add minitest_should as a gem in your Gemfile:

gem 'minitest_should' 

Run bundle install then require minitest_should like so:

require "minitest/autorun"
require "minitest/should"

Make sure your test classes inherit from Minitest::Should::TestCase

class MyTest < Minitest::Should::TestCase

  # ...

end

Testing

Testing is done with minitest. (duh!) Run the tests with:

rake

Changelog

**2014/8/19 - v0.3.2

  • refactor to Minitest v5.4 for Rails 4.1

2012/1/26 - v0.3.1

  • always alias setup to before, even if rails is present

2012/1/20 - v0.3.0

  • don't pollute minitest/unit/testcase
  • subclass minitest/spec as minitest/should/test_case
  • alias before and after as setup and teardown

2011/12/8 - v0.2.0

  • add contexts

2011/11/8 - v0.1.1

  • ensure dynamic methods have safe names

2011/11/8 - v0.1.0

  • it exists!

License

Copyright (c) 2011 - 2012 Spencer Steffen & Citrus, released under the New BSD License All rights reserved.