Augustin Riedinger
Augustin Riedinger

Reputation: 22228

Rails upgrade: rake test does nothing

After upgrading my rails app to 4.2, I started writing automated tests.

I started by doing something super simple:

class SimpleTest < ActionDispatch::IntegrationTest
  test 'Browse a page' do
    assert true
    get '/'
    assert_response :success
  end
end

But when I:

▶ rake test
▶ bin/rake test

Nothing happens. No error, no blocking, process finishes, just nothing.

Did I miss something?

Upvotes: 1

Views: 218

Answers (1)

Augustin Riedinger
Augustin Riedinger

Reputation: 22228

I was missing the require 'test_helper' at the beginning of my test, containing:

# /test/test_helper.rb
ENV["RAILS_ENV"] ||= "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'

class ActiveSupport::TestCase
  ActiveRecord::Migration.check_pending!

  # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
  #
  # Note: You'll currently still have to declare fixtures explicitly in integration tests
  # -- they do not yet inherit this setting
  fixtures :all

  # Add more helper methods to be used by all tests here...
end

Upvotes: 1

Related Questions