Permalink
Browse files

Moved relation's test to relation_test.

  • Loading branch information...
1 parent c01c21b commit 3747f896a1b727d67e6022001007e5f58b24a267 @miloops miloops committed Oct 5, 2009
@@ -667,7 +667,7 @@ def all(*args)
options = args.extract_options!
- if options.empty? #&& !scoped?(:find)
+ if options.empty? && !scoped?(:find)
relation = arel_table
else
include_associations = merge_includes(scope(:find, :include), options[:include])
@@ -1751,7 +1751,6 @@ def construct_finder_arel(options = {}, scope = scope(:find))
relation = relation.readonly if options[:readonly]
relation
-
end
def construct_finder_sql(options, scope = scope(:find))
@@ -593,12 +593,12 @@ def test_default_scope
end
def test_default_scope_with_conditions_string
- assert_equal Developer.find_all_by_name('David').map(&:id).sort, DeveloperCalledDavid.all.to_a.map(&:id).sort
+ assert_equal Developer.find_all_by_name('David').map(&:id).sort, DeveloperCalledDavid.find(:all).map(&:id).sort
assert_equal nil, DeveloperCalledDavid.create!.name
end
def test_default_scope_with_conditions_hash
- assert_equal Developer.find_all_by_name('Jamis').map(&:id).sort, DeveloperCalledJamis.all.to_a.map(&:id).sort
+ assert_equal Developer.find_all_by_name('Jamis').map(&:id).sort, DeveloperCalledJamis.find(:all).map(&:id).sort
assert_equal 'Jamis', DeveloperCalledJamis.create!.name
end
@@ -114,5 +114,16 @@ def test_find_with_included_associations
posts.first.author
end
end
+
+ def test_default_scope_with_conditions_string
+ assert_equal Developer.find_all_by_name('David').map(&:id).sort, DeveloperCalledDavid.all.to_a.map(&:id).sort
+ assert_equal nil, DeveloperCalledDavid.create!.name
+ end
+
+ def test_default_scope_with_conditions_hash
+ assert_equal Developer.find_all_by_name('Jamis').map(&:id).sort, DeveloperCalledJamis.all.to_a.map(&:id).sort
+ assert_equal 'Jamis', DeveloperCalledJamis.create!.name
+ end
+
end
2 arel
Submodule arel updated 60 files
+3 −0 .gitmodules
+2 −0 Rakefile
+5 −7 lib/arel.rb
+1 −1 spec/arel/algebra/unit/predicates/binary_spec.rb
+1 −1 spec/arel/algebra/unit/predicates/equality_spec.rb
+1 −1 spec/arel/algebra/unit/predicates/in_spec.rb
+1 −1 spec/arel/algebra/unit/primitives/attribute_spec.rb
+1 −1 spec/arel/algebra/unit/primitives/expression_spec.rb
+1 −1 spec/arel/algebra/unit/primitives/value_spec.rb
+1 −1 spec/arel/algebra/unit/relations/alias_spec.rb
+1 −1 spec/arel/algebra/unit/relations/delete_spec.rb
+1 −1 spec/arel/algebra/unit/relations/group_spec.rb
+1 −1 spec/arel/algebra/unit/relations/insert_spec.rb
+1 −1 spec/arel/algebra/unit/relations/join_spec.rb
+1 −1 spec/arel/algebra/unit/relations/order_spec.rb
+1 −1 spec/arel/algebra/unit/relations/project_spec.rb
+1 −1 spec/arel/algebra/unit/relations/relation_spec.rb
+1 −1 spec/arel/algebra/unit/relations/skip_spec.rb
+1 −1 spec/arel/algebra/unit/relations/table_spec.rb
+1 −1 spec/arel/algebra/unit/relations/take_spec.rb
+1 −1 spec/arel/algebra/unit/relations/update_spec.rb
+1 −1 spec/arel/algebra/unit/relations/where_spec.rb
+1 −1 spec/arel/algebra/unit/session/session_spec.rb
+1 −1 spec/arel/engines/memory/integration/joins/cross_engine_spec.rb
+1 −1 spec/arel/engines/memory/unit/relations/array_spec.rb
+1 −1 spec/arel/engines/memory/unit/relations/insert_spec.rb
+1 −1 spec/arel/engines/memory/unit/relations/join_spec.rb
+1 −1 spec/arel/engines/memory/unit/relations/order_spec.rb
+1 −1 spec/arel/engines/memory/unit/relations/project_spec.rb
+1 −1 spec/arel/engines/memory/unit/relations/skip_spec.rb
+1 −1 spec/arel/engines/memory/unit/relations/take_spec.rb
+1 −1 spec/arel/engines/memory/unit/relations/where_spec.rb
+1 −1 spec/arel/engines/sql/integration/joins/with_adjacency_spec.rb
+1 −1 spec/arel/engines/sql/integration/joins/with_aggregations_spec.rb
+1 −1 spec/arel/engines/sql/integration/joins/with_compounds_spec.rb
+1 −1 spec/arel/engines/sql/unit/engine_spec.rb
+1 −1 spec/arel/engines/sql/unit/predicates/binary_spec.rb
+1 −1 spec/arel/engines/sql/unit/predicates/equality_spec.rb
+1 −1 spec/arel/engines/sql/unit/predicates/in_spec.rb
+1 −1 spec/arel/engines/sql/unit/predicates/predicates_spec.rb
+1 −1 spec/arel/engines/sql/unit/primitives/attribute_spec.rb
+1 −1 spec/arel/engines/sql/unit/primitives/expression_spec.rb
+1 −1 spec/arel/engines/sql/unit/primitives/literal_spec.rb
+1 −1 spec/arel/engines/sql/unit/primitives/value_spec.rb
+1 −1 spec/arel/engines/sql/unit/relations/alias_spec.rb
+1 −1 spec/arel/engines/sql/unit/relations/delete_spec.rb
+1 −1 spec/arel/engines/sql/unit/relations/group_spec.rb
+1 −1 spec/arel/engines/sql/unit/relations/insert_spec.rb
+1 −1 spec/arel/engines/sql/unit/relations/join_spec.rb
+1 −1 spec/arel/engines/sql/unit/relations/order_spec.rb
+1 −1 spec/arel/engines/sql/unit/relations/project_spec.rb
+1 −1 spec/arel/engines/sql/unit/relations/skip_spec.rb
+1 −1 spec/arel/engines/sql/unit/relations/table_spec.rb
+1 −1 spec/arel/engines/sql/unit/relations/take_spec.rb
+1 −1 spec/arel/engines/sql/unit/relations/update_spec.rb
+1 −1 spec/arel/engines/sql/unit/relations/where_spec.rb
+2 −1 spec/connections/mysql_connection.rb
+2 −1 spec/connections/postgresql_connection.rb
+3 −2 spec/connections/sqlite3_connection.rb
+1 −0 vendor/rails

0 comments on commit 3747f89

Please sign in to comment.