require 'test_name'
for each test you want to run in your suite. This does work, but it can become a maintenance pain.When developing a Ruby application I generally put all my tests in a
Test
folder or in folders that are descendants of Test
. When I want to execute all the tests, I simply need to require all files that are in or below Test
.require 'find'That's it. All files below
Find.find(File.dirname(__FILE__)) do |path|
Find.prune if path =~ /#{File.expand_path('.')}\/#{__FILE__}$/
require path.reverse.chomp(File.expand_path('.').reverse).chomp('/').reverse.chomp('.rb') if !File.directory?(path)
end
Test
will be required and therefore executed.
We use the following
ReplyDeleteDir['**/*_test.rb'].each { |testCase| require testCase }
It is pretty concise. It will require all files in subdirectories. We just end all test files with "_test.rb"
Hi jay,
ReplyDeleteWhat IDE would you recommend for writing ruby apps/pages please as l have seen a few but nothing that grabs my attention.
Hello Michael,
ReplyDeleteIntelliJ IDEA has many features that are wonderful such as Subversion integration, local history, and JavaScript support. Unfortunately, it does not support Ruby well. However, with a few tricks and a hack I think IntelliJ is your best option.