Last active
August 17, 2016 13:53
-
-
Save prakashmurthy/6cce5eb773d1adc988c8c2fc7fc70026 to your computer and use it in GitHub Desktop.
Files for adding a new test in rails codebase for issue #26122
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# activerecord/test/cases/my_assignment_test.rb | |
require "cases/helper" | |
require "models/stat" | |
class MyAssignmentTest < ActiveRecord::TestCase | |
ActiveRecord::Schema.define do | |
create_table :stats, force: true do |t| | |
t.integer :count, default: 0 | |
end | |
end | |
def test_thousands_of_assignments | |
stat = Stat.new | |
20_000.times { stat.count += 1 } | |
assert stat.save | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# activerecord/test/models/stat.rb | |
class Stat < ActiveRecord::Base | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script to run the above test | |
bundle exec ruby -I activerecord/lib:activerecord/test activerecord/test/cases/my_assignment_test.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment