diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-04-12 17:33:56 -0700 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-04-12 17:33:56 -0700 |
commit | 97f89cde2af330771d0df80491e718f8b0cb7dd6 (patch) | |
tree | 706d3f96a552b38cbd75b7eeb228e691027a2175 /spec | |
parent | 0f3657fb70bc14720e32e5f78e521764d7a9bc06 (diff) | |
download | rails-97f89cde2af330771d0df80491e718f8b0cb7dd6.tar.gz rails-97f89cde2af330771d0df80491e718f8b0cb7dd6.tar.bz2 rails-97f89cde2af330771d0df80491e718f8b0cb7dd6.zip |
tests of Value
Diffstat (limited to 'spec')
-rw-r--r-- | spec/active_relation/unit/primitives/value_spec.rb | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/spec/active_relation/unit/primitives/value_spec.rb b/spec/active_relation/unit/primitives/value_spec.rb index f87f5c14cb..ab632ef987 100644 --- a/spec/active_relation/unit/primitives/value_spec.rb +++ b/spec/active_relation/unit/primitives/value_spec.rb @@ -1 +1,28 @@ -# TODO
\ No newline at end of file +require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper') + +module ActiveRelation + describe Value do + before do + @relation = Table.new(:users) + end + + describe '#to_sql' do + it "appropriately quotes the value" do + Value.new(1, @relation).to_sql.should be_like('1') + Value.new('asdf', @relation).to_sql.should be_like("'asdf'") + end + end + + describe '#format' do + it "returns the sql of the provided object" do + Value.new(1, @relation).format(@relation[:id]).should == @relation[:id].to_sql + end + end + + describe '#bind' do + it "manufactures a new value whose relation is the provided relation" do + Value.new(1, @relation).bind(another_relation = Table.new(:photos)).should == Value.new(1, another_relation) + end + end + end +end
\ No newline at end of file |