Sha256: 52d1806023f40bceaa080e5495ec770e76f75183977a52637185a5aa45ead18d

Contents?: true

Size: 698 Bytes

Versions: 7

Compression:

Stored size: 698 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.with_fetch(:id=>1).destroy
    @m.db.sqls.must_equal ['BEGIN', 'SELECT * FROM items', 'DELETE FROM items WHERE id = 1', 'COMMIT']
  end
end

Version data entries

7 entries across 6 versions & 2 rubygems

Version Path
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/sequel-4.44.0/spec/extensions/scissors_spec.rb
tdiary-5.0.5 vendor/bundle/gems/sequel-4.44.0/spec/extensions/scissors_spec.rb
tdiary-5.0.4 vendor/bundle/gems/sequel-4.44.0/spec/extensions/scissors_spec.rb
sequel-4.44.0 spec/extensions/scissors_spec.rb
sequel-4.43.0 spec/extensions/scissors_spec.rb
sequel-4.42.1 spec/extensions/scissors_spec.rb
sequel-4.42.0 spec/extensions/scissors_spec.rb