Week of May 13 - May 19, 2013
The master code is, as one would expect, in upheaval again. This week featured a big rewrite of callback internals, though I haven't sussed out whether it changes any features in that area.
3073c531 adds Minitest 5 compatibility to Rails 4.
Release Notes
Official support for MiniTest v5. Fixes issue #156 . Thanks to Ryan Davis .
…for reporting.
Safer restoration of stubbed method visibility. Fixes issue #141 . Thanks to Aman Gupta .
Ensure Mockery instance gets reset even if exception raised. Fixes issue #144 .
Adapt Mocha acceptance tests to cope with changes in output from latest (v4.6.2) of MiniTest.
Updates to README about Rails compatibility.
A striking parallel with MiniTest
Another new instance of the ExampleGroup subclass is created. Remember, RSpec created one instance of the class for the before :all blocks, but now it's creating a fresh instance for this specific spec to be evaluated against.
Thinking back to how MiniTest works , there's a striking parallel: where MiniTest would instantiate a new instance of the MiniTest::Unit:: TestCase for each test method, RSpec is creating a new instance …
MiniTest::Unit, a.a. the "runner"
The call to MiniTest:: Unit.new.run simply calls MiniTest:: Unit.runner. run , passing the command-line arguments through. runner is a class method on MiniTest::Unit , which returns an instance of MiniTest::Unit by default, although it can be configured to return anything else by setting MiniTest:: Unit.runner = <something else> .
So, an instance of MiniTest::Unit was created in the unit test, which then calls run on …
MiniTest for testing
Fat Models, Skinny Controllers
There has been a ‘second default stack' brewing for a while now. I'm going to call this the "Prime stack". This stack's approximate choices are:
Haml for view templates
PostgreSQL for databases
Rspec/ Cucumber for testing
Skinny models, controllers, and a service layer
But his metaphor breaks down a little, because the second stack isn't really a stack:
A considerable minority …
Minitest Chef
As mentioned previously, with two noted exceptions, the minitest-chef tests are located in the files/default/tests/minitest directory of the apache2 cookbook. We use minitest-chef-handler RubyGem with minitest-handler cookbook to automatically run tests on the node after the specified configuration has been converged with test-kitchen.
Additionally, some helper methods are in the support directory for minitest-chef to use. This should be required in any …
Phil Cohen ( phlipper ) added MiniTest syntax methods to the GETTING STARTED.md page for factory_girl in 06ff258 .
neat
neat got some help from Reda Lemeden ( kaishin ) including a fix for breakpoint values in the README 120ce1b and support for using both min- and max- in breakpoint() 9292467 .
dotfiles
Our dotfiles are now more tmux compatible thanks to Joshua Clayton ( joshuaclayton ) …
…] - [regression] provider for resource changes post-10.12.0 breaks node attribute usage in MiniTest:: Chef
[ CHEF-3416 ] - Incorrect reference to object.raw data when editing a data bag with print after specified
[ CHEF-3435 ] - deploy resource doesn't create the deploy to or shared path directories
[ CHEF-3443 ] - Failed registration results in an exception, masking the true failure
[ CHEF-3449 ] - …
This is because MiniTest by default runs your tests in random order. This is a good thing because it prevents your tests from accidentally becoming order-dependent due to "state leakage". If you find that your tests are breaking randomly, it is most likely due to this state leakage. You can run your tests with the same seed to reproduce the problem: rake TESTOPTS="--seed=1261"
Skip Tests
MiniTest allows you to easily skip tests that are not working with the `skip` …