Sha256: 491db343299c56af60d91bd6fedade5036a5e2520c52291defb8ed029b216dd5

Contents?: true

Size: 583 Bytes

Versions: 8

Compression:

Stored size: 583 Bytes

Contents

require 'helper'

describe 'update_all' do
  after do
    Post.destroy_all
  end

  it 'supports conditions' do
    foo = Post.create title: 'foo'
    bar = Post.create title: 'bar'

    assert_deprecated { Post.update_all({ title: 'omg' }, title: 'foo') }

    foo.reload.title.must_equal 'omg'
    bar.reload.title.must_equal 'bar'
  end

  it 'supports limit and order' do
    posts = 3.times.map { Post.create }
    assert_deprecated { Post.update_all({ title: 'omg' }, nil, limit: 2, order: :id) }

    posts.each(&:reload).map(&:title).must_equal ['omg', 'omg', nil]
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
challah-1.0.0 vendor/bundle/gems/activerecord-deprecated_finders-1.0.3/test/update_all_test.rb
activerecord-deprecated_finders-1.0.3 test/update_all_test.rb
activerecord-deprecated_finders-1.0.2 test/update_all_test.rb
activerecord-deprecated_finders-1.0.1 test/update_all_test.rb
activerecord-deprecated_finders-1.0.0 test/update_all_test.rb
activerecord-deprecated_finders-0.0.3 test/update_all_test.rb
activerecord-deprecated_finders-0.0.2 test/update_all_test.rb
activerecord-deprecated_finders-0.0.1 test/update_all_test.rb