提交 4127484b 编写于 作者: A Aaron Patterson

adding first node

上级 196b4e05
require 'arel/version'
require 'arel/table'
require 'arel/attributes'
require 'arel/nodes'
# below is deprecated
require 'arel/sql/engine'
module Arel
module Attributes
class Attribute < Struct.new :relation, :name, :column
def eq other
Nodes::Equality.new self, other
end
end
class String < Attribute; end
class Time < Attribute; end
class String < Attribute; end
class Time < Attribute; end
class Boolean < Attribute; end
class Decimal < Attribute; end
class Float < Attribute; end
class Float < Attribute; end
class Integer < Attribute; end
end
end
require 'arel/nodes/equality'
module Arel
module Nodes
class Equality
attr_accessor :left, :right
def initialize left, right
@left = left
@right = right
end
end
end
end
require 'spec_helper'
module Arel
module Attributes
describe 'attribute' do
describe '#eq' do
it 'should return an equality node' do
attribute = Attribute.new nil, nil, nil
equality = attribute.eq 1
equality.left.should == attribute
equality.right.should == 1
equality.should be_kind_of Nodes::Equality
end
end
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册