File: unlimited_update_spec.rb

package info (click to toggle)
ruby-sequel 5.63.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,408 kB
  • sloc: ruby: 113,747; makefile: 3
file content (21 lines) | stat: -rw-r--r-- 595 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require_relative "spec_helper"

describe "Sequel::Plugins::UnlimitedUpdate" do
  before do
    @db = Sequel.mock(:host=>'mysql', :numrows=>1)
    @db.extend_datasets{def quote_identifiers?; false end}
    @c = Class.new(Sequel::Model(@db[:test]))
    @c.columns :id, :name
    @o = @c.load(:id=>1, :name=>'a')
    @db.sqls
  end

  it "should remove limit from update dataset" do
    @o.save
    @db.sqls.must_equal ["UPDATE test SET name = 'a' WHERE (id = 1) LIMIT 1"]

    @c.plugin :unlimited_update
    @o.save
    @db.sqls.must_equal ["UPDATE test SET name = 'a' WHERE (id = 1)"]
  end
end