File: delete_spec.rb

package info (click to toggle)
ruby-riddle 2.3.1-2~deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,752 kB
  • sloc: sql: 25,022; php: 5,992; ruby: 4,757; sh: 59; makefile: 5
file content (20 lines) | stat: -rw-r--r-- 606 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

require 'spec_helper'

describe Riddle::Query::Delete do
  it 'handles a single id' do
    query = Riddle::Query::Delete.new 'foo_core', 5
    query.to_sql.should == 'DELETE FROM foo_core WHERE id = 5'
  end
  
  it 'handles multiple ids' do
    query = Riddle::Query::Delete.new 'foo_core', 5, 6, 7
    query.to_sql.should == 'DELETE FROM foo_core WHERE id IN (5, 6, 7)'
  end
  
  it 'handles multiple ids in an explicit array' do
    query = Riddle::Query::Delete.new 'foo_core', [5, 6, 7]
    query.to_sql.should == 'DELETE FROM foo_core WHERE id IN (5, 6, 7)'
  end
end