Last Updated: February 25, 2016
·
566
· kalashnikovisme

TConsole in Rails 4

Controller's tests is at test/controllers directory in Rails 4 project, but in Rails 3.* tests is at test/functional. TConsole doesn't detect tests in Rails 4 with message:

No test files match your requested test set: test/unit/**/*_test.rb,test/functional/**/*_test.rb,test/integration/**/*_test.rb. 
Skipping execution.

You should create configuration file .tconsole in root project directory and put such configs:

TConsole::Config.run do |config|
  # File sets are the named sets of files that can be executed. A file
  # set named "all" must be included.
  config.file_sets = {
    "all" => ["test/**/*_test.rb"]
  }

  # Specifies code to be run before each test execution
  config.before_test_run do
    puts "RUN WITH CONFIG FOR RAILS 4!!!"
  end
end

Now TConsole detect your tests in test/controllers and you have message in console that TConsole is running with configs.