diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-08-14 08:20:32 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-08-14 08:20:32 +0000 |
commit | 035edd39c422c9434147a1b0ac457cb9383c9b5b (patch) | |
tree | 4b25e158e04068c535e828c04f336c769ac9db9c /test/test_helper.rb | |
parent | 763d5dddde2c7dda03fe529c9dfe0d553669c277 (diff) | |
download | redmine-035edd39c422c9434147a1b0ac457cb9383c9b5b.tar.gz redmine-035edd39c422c9434147a1b0ac457cb9383c9b5b.zip |
Import issues from CSV file (#950).
git-svn-id: http://svn.redmine.org/redmine/trunk@14493 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r-- | test/test_helper.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb index 2b75a0a34..0ee9b6357 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -183,10 +183,16 @@ class ActiveSupport::TestCase # Asserts that a new record for the given class is created # and returns it def new_record(klass, &block) - assert_difference "#{klass}.count" do + new_records(klass, 1, &block).first + end + + # Asserts that count new records for the given class are created + # and returns them as an array order by object id + def new_records(klass, count, &block) + assert_difference "#{klass}.count", count do yield end - klass.order(:id => :desc).first + klass.order(:id => :desc).limit(count).to_a.reverse end def assert_save(object) |