Sha256: bb9f9096432f61531e317848c5a1ff5044bb4245c186860714631d24bcb3c592

Contents?: true

Size: 704 Bytes

Versions: 21

Compression:

Stored size: 704 Bytes

Contents

require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper")

describe "scissors plugin" do
  before do
    @m = Class.new(Sequel::Model(:items))
    @m.use_transactions = true
    @m.plugin :scissors
    @m.db.sqls
  end

  it "Model.delete should delete from the dataset" do
    @m.delete
    @m.db.sqls.must_equal ['DELETE FROM items']
  end

  it "Model.update should update the dataset" do
    @m.update(:a=>1)
    @m.db.sqls.must_equal ['UPDATE items SET a = 1']
  end

  it "Model.destory each instance in the dataset" do
    @m.dataset._fetch = {:id=>1}
    @m.destroy
    @m.db.sqls.must_equal ['BEGIN', 'SELECT * FROM items', 'DELETE FROM items WHERE id = 1', 'COMMIT']
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
sequel-4.41.0 spec/extensions/scissors_spec.rb
sequel-4.40.0 spec/extensions/scissors_spec.rb
sequel-4.39.0 spec/extensions/scissors_spec.rb
tdiary-5.0.2 vendor/bundle/gems/sequel-4.37.0/spec/extensions/scissors_spec.rb
sequel-4.38.0 spec/extensions/scissors_spec.rb
sequel-4.37.0 spec/extensions/scissors_spec.rb
sequel-4.36.0 spec/extensions/scissors_spec.rb
tdiary-5.0.1 vendor/bundle/gems/sequel-4.35.0/spec/extensions/scissors_spec.rb
sequel-4.35.0 spec/extensions/scissors_spec.rb
sequel-4.34.0 spec/extensions/scissors_spec.rb
sequel-4.33.0 spec/extensions/scissors_spec.rb
sequel-4.32.0 spec/extensions/scissors_spec.rb
sequel-4.31.0 spec/extensions/scissors_spec.rb
sequel-4.30.0 spec/extensions/scissors_spec.rb
sequel-4.29.0 spec/extensions/scissors_spec.rb
sequel-4.28.0 spec/extensions/scissors_spec.rb
sequel-4.27.0 spec/extensions/scissors_spec.rb
sequel-4.26.0 spec/extensions/scissors_spec.rb
sequel-4.25.0 spec/extensions/scissors_spec.rb
sequel-4.24.0 spec/extensions/scissors_spec.rb