]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/diary_entries_controller_test.rb
Merge remote-tracking branch 'upstream/pull/2597'
[rails.git] / test / controllers / diary_entries_controller_test.rb
index 8414e18a704883272a74027021cb799b0b975879..8996e40eee330a9550e3aa108e8b709165fa860c 100644 (file)
@@ -4,6 +4,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
   include ActionView::Helpers::NumberHelper
 
   def setup
+    super
     # Create the default language for diary entries
     create(:language, :code => "en")
     # Stub nominatim response for diary entry locations
@@ -739,7 +740,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
     post :hide,
          :params => { :display_name => user.display_name, :id => diary_entry.id }
     assert_response :forbidden
-    assert_equal true, DiaryEntry.find(diary_entry.id).visible
+    assert DiaryEntry.find(diary_entry.id).visible
 
     # Now try as a normal user
     post :hide,
@@ -747,7 +748,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
          :session => { :user => user }
     assert_response :redirect
     assert_redirected_to :controller => :errors, :action => :forbidden
-    assert_equal true, DiaryEntry.find(diary_entry.id).visible
+    assert DiaryEntry.find(diary_entry.id).visible
 
     # Now try as a moderator
     post :hide,
@@ -755,7 +756,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
          :session => { :user => create(:moderator_user) }
     assert_response :redirect
     assert_redirected_to :action => :index, :display_name => user.display_name
-    assert_equal false, DiaryEntry.find(diary_entry.id).visible
+    assert_not DiaryEntry.find(diary_entry.id).visible
 
     # Reset
     diary_entry.reload.update(:visible => true)
@@ -766,7 +767,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
          :session => { :user => create(:administrator_user) }
     assert_response :redirect
     assert_redirected_to :action => :index, :display_name => user.display_name
-    assert_equal false, DiaryEntry.find(diary_entry.id).visible
+    assert_not DiaryEntry.find(diary_entry.id).visible
   end
 
   def test_unhide
@@ -777,7 +778,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
     post :unhide,
          :params => { :display_name => user.display_name, :id => diary_entry.id }
     assert_response :forbidden
-    assert_equal false, DiaryEntry.find(diary_entry.id).visible
+    assert_not DiaryEntry.find(diary_entry.id).visible
 
     # Now try as a normal user
     post :unhide,
@@ -785,7 +786,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
          :session => { :user => user }
     assert_response :redirect
     assert_redirected_to :controller => :errors, :action => :forbidden
-    assert_equal false, DiaryEntry.find(diary_entry.id).visible
+    assert_not DiaryEntry.find(diary_entry.id).visible
 
     # Finally try as an administrator
     post :unhide,
@@ -793,7 +794,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
          :session => { :user => create(:administrator_user) }
     assert_response :redirect
     assert_redirected_to :action => :index, :display_name => user.display_name
-    assert_equal true, DiaryEntry.find(diary_entry.id).visible
+    assert DiaryEntry.find(diary_entry.id).visible
   end
 
   def test_hidecomment
@@ -805,7 +806,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
     post :hidecomment,
          :params => { :display_name => user.display_name, :id => diary_entry.id, :comment => diary_comment.id }
     assert_response :forbidden
-    assert_equal true, DiaryComment.find(diary_comment.id).visible
+    assert DiaryComment.find(diary_comment.id).visible
 
     # Now try as a normal user
     post :hidecomment,
@@ -813,7 +814,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
          :session => { :user => user }
     assert_response :redirect
     assert_redirected_to :controller => :errors, :action => :forbidden
-    assert_equal true, DiaryComment.find(diary_comment.id).visible
+    assert DiaryComment.find(diary_comment.id).visible
 
     # Try as a moderator
     post :hidecomment,
@@ -821,7 +822,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
          :session => { :user => create(:moderator_user) }
     assert_response :redirect
     assert_redirected_to :action => :show, :display_name => user.display_name, :id => diary_entry.id
-    assert_equal false, DiaryComment.find(diary_comment.id).visible
+    assert_not DiaryComment.find(diary_comment.id).visible
 
     # Reset
     diary_comment.reload.update(:visible => true)
@@ -832,7 +833,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
          :session => { :user => create(:administrator_user) }
     assert_response :redirect
     assert_redirected_to :action => :show, :display_name => user.display_name, :id => diary_entry.id
-    assert_equal false, DiaryComment.find(diary_comment.id).visible
+    assert_not DiaryComment.find(diary_comment.id).visible
   end
 
   def test_unhidecomment
@@ -844,7 +845,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
     post :unhidecomment,
          :params => { :display_name => user.display_name, :id => diary_entry.id, :comment => diary_comment.id }
     assert_response :forbidden
-    assert_equal false, DiaryComment.find(diary_comment.id).visible
+    assert_not DiaryComment.find(diary_comment.id).visible
 
     # Now try as a normal user
     post :unhidecomment,
@@ -852,7 +853,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
          :session => { :user => user }
     assert_response :redirect
     assert_redirected_to :controller => :errors, :action => :forbidden
-    assert_equal false, DiaryComment.find(diary_comment.id).visible
+    assert_not DiaryComment.find(diary_comment.id).visible
 
     # Finally try as an administrator
     post :unhidecomment,
@@ -860,7 +861,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
          :session => { :user => administrator_user }
     assert_response :redirect
     assert_redirected_to :action => :show, :display_name => user.display_name, :id => diary_entry.id
-    assert_equal true, DiaryComment.find(diary_comment.id).visible
+    assert DiaryComment.find(diary_comment.id).visible
   end
 
   def test_comments
@@ -872,7 +873,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
     get :comments, :params => { :display_name => user.display_name }
     assert_response :success
     assert_template :comments
-    assert_select "table.messages" do
+    assert_select "table.table-striped" do
       assert_select "tr", :count => 1 # header, no comments
     end
 
@@ -882,7 +883,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
     get :comments, :params => { :display_name => other_user.display_name }
     assert_response :success
     assert_template :comments
-    assert_select "table.messages" do
+    assert_select "table.table-striped" do
       assert_select "tr", :count => 2 # header and one comment
     end