Is it possible and does anyone have experience using minitest and rspec? I'm just wondering if it's possible to slowly migrate from one to the other and have both get along in the mean time.
I tried setting up some minitest tests in an rspec project and it's just failing silently at this point. I've even removed the rspec-rails gem but still
rake test my/test/file.rb
just silently returns.
RSpec has the same goals as Minitest but focuses on readable specifications describing how the application is supposed to behave with a close match to English. Minitest purports that if you know Ruby well, it should be enough. The RSpec project focuses on behavior-driven development (BDD) and specification writing.
What is Minitest? Minitest is a testing tool for Ruby that provides a complete suite of testing facilities. It also supports behaviour-driven development, mocking and benchmarking. With the release of Ruby 1.9, it was added to Ruby's standard library, which increased its popularity.
Stability can become an issue as web applications evolve and grow – integration tests provide a great way to perform end-to-end tests that validate the application is performing as expected.
I just revisited this and it seems like Rspec and Minitest work fine together "out of the box" without needing minitest-rails.
I'm not however using minitest/spec so I don't know about how that would integrate.
My issue was that the project in question was explicitly setting up individual railties in config/application.rb just to exclude "rails/test_unit/railtie" which is great if you just want rspec.
I put it back to the default
require 'rails/all'
and now both rspec specs run with
rake spec
and minitest tests run with
rake test
I wanted both to run buy default with just
rake
So I put this in my Rakefile
Rake::Task["default"].clear if Rake::Task.task_defined?("default")
task :default do
puts "Starting specs"
system('bundle exec rake spec')
puts "Starting Minitest tests"
system('bundle exec rake test')
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With