mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Implement equality for BindParam
It is impossible to test equality of things constructing trees with bind params otherwise.
This commit is contained in:
parent
9d773cd116
commit
d36a769234
2 changed files with 18 additions and 0 deletions
|
@ -1,6 +1,9 @@
|
|||
module Arel
|
||||
module Nodes
|
||||
class BindParam < Node
|
||||
def ==(other)
|
||||
other.is_a?(BindParam)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
15
test/nodes/test_bind_param.rb
Normal file
15
test/nodes/test_bind_param.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'helper'
|
||||
|
||||
module Arel
|
||||
module Nodes
|
||||
describe 'BindParam' do
|
||||
it 'is equal to other bind params' do
|
||||
BindParam.new.must_equal(BindParam.new)
|
||||
end
|
||||
|
||||
it 'is not equal to other nodes' do
|
||||
BindParam.new.wont_equal(Node.new)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue