3 class RelationsControllerTest < ActionDispatch::IntegrationTest
 
   5   # test all routes which lead to this controller
 
   8       { :path => "/relation/1", :method => :get },
 
   9       { :controller => "relations", :action => "show", :id => "1" }
 
  14     relation = create(:relation)
 
  15     sidebar_browse_check :relation_path, relation.id, "elements/show"
 
  16     assert_select "h4", /^Version/ do
 
  17       assert_select "a[href='#{old_relation_path relation, 1}']", :text => "1", :count => 1
 
  19     assert_select ".secondary-actions a[href='#{api_relation_path relation}']", :count => 1
 
  20     assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1
 
  21     assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0
 
  24   def test_show_multiple_versions
 
  25     relation = create(:relation, :with_history, :version => 2)
 
  26     sidebar_browse_check :relation_path, relation.id, "elements/show"
 
  27     assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1
 
  28     assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 1
 
  29     assert_select ".secondary-actions a[href='#{old_relation_path relation, 2}']", :count => 1
 
  32   def test_show_relation_member
 
  33     member = create(:relation)
 
  34     relation = create(:relation)
 
  35     create(:relation_member, :relation => relation, :member => member)
 
  36     sidebar_browse_check :relation_path, member.id, "elements/show"
 
  37     assert_select "a[href='#{relation_path relation}']", :count => 1
 
  41     relation = create(:relation)
 
  42     with_settings(:web_timeout => -1) do
 
  43       get relation_path(relation)
 
  45     assert_response :error
 
  46     assert_template :layout => "map"
 
  47     assert_dom "h2", "Timeout Error"
 
  48     assert_dom "p", /#{Regexp.quote("the relation with the id #{relation.id}")}/