Sha256: e136e7248d84dc8715bb9486064f6b9dfce6a878f4efa3153d55167d0b7a0c27

Contents?: true

Size: 531 Bytes

Versions: 4

Compression:

Stored size: 531 Bytes

Contents

require 'cases/helper'

class AutosaveAssociationBugReproductionTest < ActiveRecord::CountLoader::TestCase
  def setup
    tweets_count.times do |i|
      tweet = Tweet.create
      i.times do |j|
        Favorite.create(tweet: tweet, user_id: j + 1)
      end
    end
  end

  def teardown
    [Tweet, Favorite].each(&:delete_all)
  end

  def tweets_count
    3
  end

  def test_bug_with_save_belongs_to_association_method_fixed
    tweet = Tweet.first
    tweet.my_favorites_count
    assert_equal(true, tweet.save!)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activerecord-precount-0.7.0 test/cases/associations/autosave_association_bug_reproduction_test.rb
activerecord-precount-0.7.0.beta1 test/cases/associations/autosave_association_bug_reproduction_test.rb
activerecord-precount-0.6.3 test/cases/associations/autosave_association_bug_reproduction_test.rb
activerecord-precount-0.6.2 test/cases/associations/autosave_association_bug_reproduction_test.rb