Sha256: 480b9f563ebccab5c158036f083f19d8e74ea08accb5bd16e3db2b574d850463
Contents?: true
Size: 942 Bytes
Versions: 4
Compression:
Stored size: 942 Bytes
Contents
$:.unshift File.join(File.dirname(__FILE__), 'lib') $DBG = true require 'test/unit' require 'og' class TC_Query < Test::Unit::TestCase # :nodoc: all include Og class Item property :quantity, Fixnum property :unit_price, Float def initialize(quantity, unit_price) @quantity = quantity @unit_price = unit_price end def total_price @total_price.to_f end end def setup @og = Og.setup( :destroy => true, :store => :mysql, # :store => :sqlite, # :store => :psql, # :user => 'postgres', :user => 'root', :password => 'navelrulez', :name => 'test' ) end def test_all Item.create(2, 34.5) Item.create(5, 12.6) item = Item.one :select => 'quantity, quantity*unit_price as total_price', :condition => 'oid = 1' assert_equal 2*34.5, item.total_price assert_equal 2, item.quantity.to_i end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
og-0.21.0 | test/og/tc_select.rb |
og-0.21.2 | test/og/tc_select.rb |
og-0.22.0 | test/og/tc_select.rb |
og-0.23.0 | test/og/tc_select.rb |