Project

General

Profile

Patch #31066 » 31066-fix-broken-tests.patch

Takenori TAKAKI, 2019-03-22 14:55

View differences:

app/views/users/show.html.erb
77 77

  
78 78
<% unless @memberships.empty? %>
79 79
<h3><%=l(:label_project_plural)%></h3>
80
<ul>
81
<% for membership in @memberships %>
82
  <li><%= link_to_project(membership.project) %>
83
    (<%= membership.roles.sort.collect(&:to_s).join(', ') %>, <%= format_date(membership.created_on) %>)</li>
80
<table class="list memberships">
81
<thead>
82
  <tr>
83
    <th><%=l(:label_project)%></th>
84
    <th><%=l(:label_role_plural)%></th>
85
    <th><%=l(:label_registered_on)%></th>
86
  </tr>
87
</thead>
88
<tbody>
89
<% project_tree(@memberships.collect(&:project), :init_level => true) do |project, level| %>
90
  <% membership = @memberships.select{|m|m.project==project}.first %>
91
  <tr class="<%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
92
    <td class="name"><span><%= link_to_project(project) %></span></td>
93
    <td class="roles"><%= membership.roles.sort.collect(&:to_s).join(', ') %></td>
94
    <td><%= format_date(membership.created_on) %></td>
95
  </tr>
84 96
<% end %>
85
</ul>
97
</tbody>
98
</table>
86 99
<% end %>
87 100

  
88 101
<% if (User.current == @user || User.current.admin?) && @user.groups.any? %>
test/functional/users_controller_test.rb
173 173
    get :show, :params => {:id => 2}
174 174
    assert_response :success
175 175

  
176
    # membership of private project admin can see
177
    assert_select 'li a', :text => "OnlineStore"
176
    assert_select 'table.list.memberships>tbody' do
177
      assert_select 'tr:nth-of-type(1)' do
178
        assert_select 'td:nth-of-type(1)>span>a', :text => 'eCookbook'
179
        assert_select 'td:nth-of-type(2)', :text => 'Manager'
180
      end
181
      assert_select 'tr:nth-of-type(2)' do
182
        assert_select 'td:nth-of-type(1)>span>a', :text => 'Private child of eCookbook'
183
        assert_select 'td:nth-of-type(2)', :text => 'Manager'
184
      end
185
      assert_select 'tr:nth-of-type(3)' do
186
        assert_select 'td:nth-of-type(1)>span>a', :text => 'OnlineStore'
187
        assert_select 'td:nth-of-type(2)', :text => 'Developer'
188
      end
189
    end
178 190
  end
179 191

  
180 192
  def test_show_current_should_require_authentication
(7-7/8)