File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,5 +60,15 @@ def like(value)
6060 def not_like ( value )
6161 SqlCondition . new ( column : to_s , comparison : 'NOT LIKE' , value : value )
6262 end
63+
64+ # This method is called to create an IN condition for this column.
65+ def in ( value )
66+ SqlCondition . new ( column : to_s , comparison : 'IN' , value : value )
67+ end
68+
69+ # This method is called to create a NOT IN condition for this column.
70+ def not_in ( value )
71+ SqlCondition . new ( column : to_s , comparison : 'NOT IN' , value : value )
72+ end
6373 end
6474end
Original file line number Diff line number Diff line change 8484 expect ( condition . to_s ) . to eq ( '`gems`.`version` NOT LIKE ?' )
8585 end
8686 end
87+
88+ describe '#in' do
89+ it 'returns a SqlCondition for the comparison' do
90+ condition = subject . in ( '(value_1, value_2, value_3)' )
91+ expect ( condition ) . to be_a ( MysqlFramework ::SqlCondition )
92+ expect ( condition . to_s ) . to eq ( '`gems`.`version` IN ?' )
93+ end
94+ end
95+
96+ describe '#not_in' do
97+ it 'returns a SqlCondition for the comparison' do
98+ condition = subject . not_in ( '(value_1, value_2, value_3)' )
99+ expect ( condition ) . to be_a ( MysqlFramework ::SqlCondition )
100+ expect ( condition . to_s ) . to eq ( '`gems`.`version` NOT IN ?' )
101+ end
102+ end
87103end
You can’t perform that action at this time.
0 commit comments