summaryrefslogtreecommitdiffstats
path: root/test/functional/queries_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-12 17:40:19 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-12 17:40:19 +0000
commitbeb5e6039166dadc8efccb65feb0f7ee450c9558 (patch)
tree291bd88733f83345216020cc9cc00b8ec0a145f2 /test/functional/queries_controller_test.rb
parent7c6757c81a04a4351063ffd764a1afd53209d09d (diff)
downloadredmine-beb5e6039166dadc8efccb65feb0f7ee450c9558.tar.gz
redmine-beb5e6039166dadc8efccb65feb0f7ee450c9558.zip
Makes spent time queries savable (#14790).
git-svn-id: http://svn.redmine.org/redmine/trunk@15639 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/queries_controller_test.rb')
-rw-r--r--test/functional/queries_controller_test.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb
index c7ad25850..27eb48a92 100644
--- a/test/functional/queries_controller_test.rb
+++ b/test/functional/queries_controller_test.rb
@@ -58,6 +58,13 @@ class QueriesControllerTest < ActionController::TestCase
assert_response 404
end
+ def test_new_time_entry_query
+ @request.session[:user_id] = 2
+ get :new, :project_id => 1, :type => 'TimeEntryQuery'
+ assert_response :success
+ assert_select 'input[name=type][value=?]', 'TimeEntryQuery'
+ end
+
def test_create_project_public_query
@request.session[:user_id] = 2
post :create,
@@ -263,6 +270,26 @@ class QueriesControllerTest < ActionController::TestCase
assert_equal Query::VISIBILITY_PUBLIC, query.visibility
end
+ def test_create_project_public_time_entry_query
+ @request.session[:user_id] = 2
+
+ q = new_record(TimeEntryQuery) do
+ post :create,
+ :project_id => 'ecookbook',
+ :type => 'TimeEntryQuery',
+ :default_columns => '1',
+ :f => ["spent_on"],
+ :op => {"spent_on" => "="},
+ :v => { "spent_on" => ["2016-07-14"]},
+ :query => {"name" => "test_new_project_public_query", "visibility" => "2"}
+ end
+
+ assert_redirected_to :controller => 'timelog', :action => 'index', :project_id => 'ecookbook', :query_id => q.id
+ assert q.is_public?
+ assert q.has_default_columns?
+ assert q.valid?
+ end
+
def test_edit_global_public_query
@request.session[:user_id] = 1
get :edit, :id => 4