summaryrefslogtreecommitdiffstats
path: root/test/test_helper.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-06-29 16:06:37 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-06-29 16:06:37 +0000
commit004fc8b84b1cebc521664ca3830f969a91244e67 (patch)
treef84169227818ebd9365df50aeb446a2c8b977fe5 /test/test_helper.rb
parent3834b3d2ef2b7ceab8942e95b66e5a3cae63dce7 (diff)
downloadredmine-004fc8b84b1cebc521664ca3830f969a91244e67.tar.gz
redmine-004fc8b84b1cebc521664ca3830f969a91244e67.zip
Fixed that user with "Manage public queries" permission, can create global public query (#19842).
git-svn-id: http://svn.redmine.org/redmine/trunk@14388 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r--test/test_helper.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index be4e68e18..73987a592 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -180,6 +180,15 @@ class ActiveSupport::TestCase
ActiveRecord::Base.connection.quoted_date(date)
end
+ # Asserts that a new record for the given class is created
+ # and returns it
+ def new_record(klass, &block)
+ assert_difference "#{klass}.count" do
+ yield
+ end
+ klass.order(:id => :desc).first
+ end
+
def assert_save(object)
saved = object.save
message = "#{object.class} could not be saved"