diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-04-13 18:45:20 -0700 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-04-13 18:45:20 -0700 |
commit | 04c8e48311231d0b8332a7050a48defc9d7b075e (patch) | |
tree | b2ffeda286cf212d3acf67c11b01e013f4c26424 /spec/active_relation/unit/relations/grouping_spec.rb | |
parent | 4466409205d697f854f98ac0908a792a1601ecc6 (diff) | |
download | rails-04c8e48311231d0b8332a7050a48defc9d7b075e.tar.gz rails-04c8e48311231d0b8332a7050a48defc9d7b075e.tar.bz2 rails-04c8e48311231d0b8332a7050a48defc9d7b075e.zip |
new conception of grouping and aggregation functionality
Diffstat (limited to 'spec/active_relation/unit/relations/grouping_spec.rb')
-rw-r--r-- | spec/active_relation/unit/relations/grouping_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/active_relation/unit/relations/grouping_spec.rb b/spec/active_relation/unit/relations/grouping_spec.rb new file mode 100644 index 0000000000..4b5badbb8b --- /dev/null +++ b/spec/active_relation/unit/relations/grouping_spec.rb @@ -0,0 +1,33 @@ +require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper') + +module ActiveRelation + describe Grouping do + before do + @relation = Table.new(:users) + @attribute = @relation[:id] + end + + describe '#to_sql' do + describe 'when given a predicate' do + it "manufactures sql with where clause conditions" do + Grouping.new(@relation, @attribute).to_sql.should be_like(" + SELECT `users`.`id`, `users`.`name` + FROM `users` + GROUP BY `users`.`id` + ") + end + end + + describe 'when given a string' do + it "passes the string through to the where clause" do + pending 'it should not quote asdf' + Grouping.new(@relation, 'asdf').to_sql.should be_like(" + SELECT `users`.`id`, `users`.`name` + FROM `users` + GROUP BY asdf + ") + end + end + end + end +end
\ No newline at end of file |