diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-04-07 14:16:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-07 14:16:30 -0400 |
commit | 28079868d0e70bdac80c76cf806afd517edfe1e7 (patch) | |
tree | bb431934913806c51424517721fbf1e157e79359 /activerecord/test | |
parent | 8f0d8551893789f26e5d6b82ccef00779296818f (diff) | |
parent | 06f45435da941d713afefd3140421d1ced7abbdc (diff) | |
download | rails-28079868d0e70bdac80c76cf806afd517edfe1e7.tar.gz rails-28079868d0e70bdac80c76cf806afd517edfe1e7.tar.bz2 rails-28079868d0e70bdac80c76cf806afd517edfe1e7.zip |
Merge pull request #28692 from kmcphillips/master
Calling fixture accessor method with no arguments returns all fixtures rather than empty array
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/fixtures_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index 3720b0cc1a..a0a6d3c7ef 100644 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -95,6 +95,24 @@ class FixturesTest < ActiveRecord::TestCase assert_nil(topics["second"]["author_email_address"]) end + def test_no_args_returns_all + all_topics = topics + assert_equal 5, all_topics.length + assert_equal "The First Topic", all_topics.first["title"] + assert_equal 5, all_topics.last.id + end + + def test_no_args_record_returns_all_without_array + all_binaries = binaries + assert_kind_of(Array, all_binaries) + assert_equal 1, binaries.length + end + + def test_nil_raises + assert_raise(StandardError) { topics(nil) } + assert_raise(StandardError) { topics([nil]) } + end + def test_inserts create_fixtures("topics") first_row = ActiveRecord::Base.connection.select_one("SELECT * FROM topics WHERE author_name = 'David'") |