]> source.dussan.org Git - redmine.git/commitdiff
prevent random failure of MyControllerTest#test_page_with_calendar
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 18 Nov 2020 01:22:00 +0000 (01:22 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 18 Nov 2020 01:22:00 +0000 (01:22 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@20415 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/my_controller_test.rb

index f62b01a4d9dabe4ce01b0ceabb44aa066a895551..a1c76a4f2d99c172be6e464670d06ddbee749f95 100644 (file)
@@ -24,7 +24,7 @@ class MyControllerTest < Redmine::ControllerTest
            :roles, :projects, :members, :member_roles,
            :issues, :issue_statuses, :trackers, :enumerations,
            :custom_fields, :auth_sources, :queries, :enabled_modules,
-           :journals
+           :journals, :projects_trackers
 
   def setup
     @request.session[:user_id] = 2
@@ -415,13 +415,23 @@ class MyControllerTest < Redmine::ControllerTest
   end
 
   def test_page_with_calendar
-    travel_to issues(:issues_002).start_date
+    date = '2020-10-21'
+    subject = 'calendar on my page'
+    issue = Issue.generate!(:start_date => date,
+                            :due_date   => date,
+                            :project_id => 1,
+                            :tracker_id => 1,
+                            :subject => subject)
+
+    travel_to date
 
     preferences = User.find(2).pref
     preferences[:my_page_layout] = {'top' => ['calendar']}
     preferences.save!
 
-    get :page
+    with_settings :start_of_week => 7 do
+      get :page
+    end
     assert_response :success
 
     assert_select 'form[data-cm-url=?]', '/issues/context_menu'
@@ -431,10 +441,18 @@ class MyControllerTest < Redmine::ControllerTest
         assert_select 'td' do
           assert_select(
             'div.issue.hascontextmenu.tooltip.starting',
-            :text => /eCookbook.*Add ingredients categories/m
+            :text => /eCookbook.*#{subject}/m
           ) do
-            assert_select 'a.issue[href=?]', '/issues/2', :text => 'Feature request #2'
-            assert_select 'input[name=?][type=?][value=?]', 'ids[]', 'checkbox', '2'
+            assert_select(
+              'a.issue[href=?]', "/issues/#{issue.id}",
+              :text => "Bug ##{issue.id}"
+            )
+            assert_select(
+              'input[name=?][type=?][value=?]',
+              'ids[]',
+              'checkbox',
+              issue.id.to_s
+            )
           end
         end
       end