Skip to content

Commit 8eb1dd6

Browse files
committed
- Define test_order= :random to run rails tests randomly if test_order= option is available post Rails 4.2
1 parent 82f7b19 commit 8eb1dd6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/test_helper.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
# Configure Rails Environment
77
ENV["RAILS_ENV"] = "test"
88

9-
require File.expand_path("../dummy/config/environment.rb", __FILE__)
9+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
1010
require "rails/test_help"
1111
require "rails/generators"
1212
require "pathname"
1313
require 'minitest/mock'
1414

15-
CACHE_PATH = Pathname.new File.expand_path("../dummy/tmp/cache", __FILE__)
15+
CACHE_PATH = Pathname.new File.expand_path("../dummy/tmp/cache", __FILE__)
1616

1717
Rails.backtrace_cleaner.remove_silencers!
1818

@@ -29,7 +29,10 @@ def clear_sprockets_cache
2929
# so override `fresh?` to mark it as expired.
3030
def manually_expire_asset(asset_name)
3131
asset = Rails.application.assets[asset_name]
32-
def asset.fresh?(env); false; end
32+
33+
def asset.fresh?(env)
34+
; false;
35+
end
3336
end
3437

3538
# Load support files
@@ -40,6 +43,10 @@ def asset.fresh?(env); false; end
4043
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
4144
end
4245

46+
if ActiveSupport::TestCase.respond_to?(:test_order=)
47+
ActiveSupport::TestCase.test_order = :random
48+
end
49+
4350
def wait_for_turbolinks_to_be_available
4451
sleep(1)
4552
end

0 commit comments

Comments
 (0)