1 # frozen_string_literal: true
 
   5 class OldRelationMembersControllerTest < ActionDispatch::IntegrationTest
 
   8       { :path => "/relation/1/history/2/members", :method => :get },
 
   9       { :controller => "old_relation_members", :action => "show", :id => "1", :version => "2" }
 
  13   def test_show_with_members
 
  14     relation = create(:relation, :with_history)
 
  15     create(:old_relation_member, :old_relation => relation.old_relations.first)
 
  17     get old_relation_members_path(relation, 1)
 
  19     assert_response :success
 
  22   def test_show_redacted_to_unauthorized_users
 
  23     relation = create(:relation, :with_history, :version => 2)
 
  24     relation.old_relations.find_by(:version => 1).redact!(create(:redaction))
 
  26     get old_relation_members_path(relation, 1, :params => { :show_redactions => true })
 
  28     assert_response :redirect
 
  31   def test_show_redacted_to_regular_users
 
  32     relation = create(:relation, :with_history, :version => 2)
 
  33     relation.old_relations.find_by(:version => 1).redact!(create(:redaction))
 
  35     session_for(create(:user))
 
  36     get old_relation_members_path(relation, 1, :params => { :show_redactions => true })
 
  38     assert_response :redirect
 
  41   def test_show_not_found
 
  42     get old_relation_members_path(0, 0)
 
  44     assert_response :not_found
 
  48     relation = create(:relation, :with_history)
 
  50     with_settings(:web_timeout => -1) do
 
  51       get old_relation_members_path(relation, 1)
 
  54     assert_response :error