aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-04-03 17:13:24 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-04-03 17:13:24 -0300
commitae110ce5d4de8cb3a22f826b0e824f333d2b2742 (patch)
tree41065be39c3ba3df5d7a02740f105911978f24db /activerecord/test/cases
parent6da3e9ad5bf38ea54135424f360df49495c07afe (diff)
parentdb5d26c9d70fb72b8aa3ea98709224dd13800024 (diff)
downloadrails-ae110ce5d4de8cb3a22f826b0e824f333d2b2742.tar.gz
rails-ae110ce5d4de8cb3a22f826b0e824f333d2b2742.tar.bz2
rails-ae110ce5d4de8cb3a22f826b0e824f333d2b2742.zip
Merge pull request #14572 from laurocaetano/with_options_and_scope
Fix error when using `with_options` with lambda. Conflicts: activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index 3dfb0a27ba..eb0ebc75ad 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -24,6 +24,8 @@ require 'models/minivan'
require 'models/speedometer'
require 'models/reference'
require 'models/job'
+require 'models/college'
+require 'models/student'
class HasManyAssociationsTestForReorderWithJoinDependency < ActiveRecord::TestCase
fixtures :authors, :posts, :comments
@@ -65,6 +67,13 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
dev.developer_projects.map(&:project_id).sort
end
+ def test_has_many_build_with_options
+ college = College.create(name: 'UFMT')
+ student = Student.create(active: true, college_id: college.id, name: 'Sarah')
+
+ assert_equal college.students, Student.where(active: true, college_id: college.id)
+ end
+
def test_create_from_association_should_respect_default_scope
car = Car.create(:name => 'honda')
assert_equal 'honda', car.name