File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,5 +50,15 @@ def lte(value)
5050 def as ( name )
5151 "#{ self } as `#{ name } `"
5252 end
53+
54+ # This method is called to create a LIKE condition for this column.
55+ def like ( value )
56+ SqlCondition . new ( column : to_s , comparison : 'LIKE' , value : value )
57+ end
58+
59+ # This method is called to create a NOT LIKE condition for this column.
60+ def not_like ( value )
61+ SqlCondition . new ( column : to_s , comparison : 'NOT LIKE' , value : value )
62+ end
5363 end
5464end
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33module MysqlFramework
4- VERSION = '0.0.11 '
4+ VERSION = '0.0.12 '
55end
Original file line number Diff line number Diff line change 6868 expect ( subject . as ( 'v' ) ) . to eq ( '`gems`.`version` as `v`' )
6969 end
7070 end
71+
72+ describe '#like' do
73+ it 'returns a SqlCondition for the comparison' do
74+ condition = subject . like ( '%foo%' )
75+ expect ( condition ) . to be_a ( MysqlFramework ::SqlCondition )
76+ expect ( condition . to_s ) . to eq ( '`gems`.`version` LIKE ?' )
77+ end
78+ end
79+
80+ describe '#not_like' do
81+ it 'returns a SqlCondition for the comparison' do
82+ condition = subject . not_like ( '%foo%' )
83+ expect ( condition ) . to be_a ( MysqlFramework ::SqlCondition )
84+ expect ( condition . to_s ) . to eq ( '`gems`.`version` NOT LIKE ?' )
85+ end
86+ end
7187end
You can’t perform that action at this time.
0 commit comments