diff options
author | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2018-09-25 18:52:45 -0400 |
---|---|---|
committer | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2018-09-26 10:39:30 -0400 |
commit | 68890d39c9e25bccdd83407cfa6a12800093e432 (patch) | |
tree | 616d721dc00872ac7b3ae6a03591b8ba89610e54 /activerecord/test/cases | |
parent | 52e11e462f6114a4d12225c639c5f501f0ffec7a (diff) | |
download | rails-68890d39c9e25bccdd83407cfa6a12800093e432.tar.gz rails-68890d39c9e25bccdd83407cfa6a12800093e432.tar.bz2 rails-68890d39c9e25bccdd83407cfa6a12800093e432.zip |
Raise an error when loading all fixtures from nil fixture_path
[Gannon McGibbon + Max Albrecht]
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/fixtures_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index 5d5f54ca66..82ca15b415 100644 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -1344,3 +1344,19 @@ class SameNameDifferentDatabaseFixturesTest < ActiveRecord::TestCase assert_kind_of OtherDog, other_dogs(:lassie) end end + +class NilFixturePathTest < ActiveRecord::TestCase + test "raises an error when all fixtures loaded" do + error = assert_raises(StandardError) do + TestCase = Class.new(ActiveRecord::TestCase) + TestCase.class_eval do + self.fixture_path = nil + fixtures :all + end + end + assert_equal <<~MSG.squish, error.message + No fixture path found. + Please set `NilFixturePathTest::TestCase.fixture_path`. + MSG + end +end |