Project

General

Profile

Feature #35044 » 0001-Add-test.patch

Mizuki ISHIKAWA, 2021-05-08 09:23

View differences:

app/views/projects/_members_box.html.erb
<% @principals_by_role.keys.sort.each do |role| %>
<p><span class="label"><%= role %>:</span> <%= @principals_by_role[role].sort.collect{|p| link_to_user p}.join(", ").html_safe %></p>
<% end %>
<% if @project.is_public %>
<hr>
<div id="is-public-project-notice">
<p span class="label"><%= l(:field_is_public) %>:</span> <%= l(:general_text_Yes) %>
<em class="info"><%= Setting.login_required? ? l(:text_project_is_public_non_member) : l(:text_project_is_public_anonymous) %></em>
</div>
<% end -%>
</div>
<% end %>
test/functional/projects_controller_test.rb
assert_select '#main.nosidebar'
end
def test_show_should_display_is_public_project_notice
p = Project.find('ecookbook')
assert p.is_public?
with_settings :login_required => '0' do
get(:show, :params => {:id => p.identifier})
assert_response :success
assert_select '#is-public-project-notice .info', :text => l(:text_project_is_public_anonymous)
end
with_settings :login_required => '1' do
@request.session[:user_id] = 1
get(:show, :params => {:id => p.identifier})
assert_response :success
assert_select '#is-public-project-notice .info', :text => l(:text_project_is_public_non_member)
end
end
def test_show_should_display_is_private_project_notice
@request.session[:user_id] = 1
p = Project.find('private-child')
assert_not p.is_public?
get(:show, :params => {:id => p.identifier})
assert_response :success
assert_select '#is-public-project-notice', :count => 0
end
def test_show_should_display_visible_custom_fields
ProjectCustomField.find_by_name('Development status').update_attribute :visible, true
get(:show, :params => {:id => 'ecookbook'})
(2-2/4)