Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has anyone used Minitest::Spec withing a Rails functional test?

The spec library in Minitest is great. I've been able to use it within Rails unit tests no problem. However, Rails functional test inherit from ActionController::TestCase which provides instance variables like @controller in it's setup.

Has anyone been using the Minitest::Spec lib for their Rails functional tests?

If not, I'm considering creating a small library to do just that. I'm not too keen on rspec, and shoulda is starting to shift it's focus to rspec. It would be nice to have something lightweight and built on tools already provided.

like image 285
user464839 Avatar asked Oct 28 '10 15:10

user464839


People also ask

How do you run a Minitest in Rails?

To run a Minitest test, the only setup you really need is to require the autorun file at the beginning of a test file: require 'minitest/autorun' . This is good if you'd like to keep the code small. A better way to get started with Minitest is to have Bundler create a template project for you.

How to run test cases in Rails?

We can run all of our tests at once by using the bin/rails test command. Or we can run a single test file by passing the bin/rails test command the filename containing the test cases. This will run all test methods from the test case.

What is unit test in Rails?

They make sure that a section of an application, or a “unit”, is behaving as intended. In a Rails context, unit tests are what you use to test your models. Although it is possible in Rails to run all tests simultaneously, each unit test case should be tested independently to isolate issues that may arise.


1 Answers

Thoughtbot have now split shoulda into shoulda_contexts and shoulda_matchers so the worry about a shift to rspec for thoughtbot doesn't mean shoulda contexts are going away. Just being maintained in the community.

like image 197
james2m Avatar answered Sep 20 '22 19:09

james2m