Feature #29449 » 29449-not-display-closed-project_issues-functional-test.patch
| test/functional/my_controller_test.rb | ||
|---|---|---|
|
assert_select 'table.issues.sort-by-due-date'
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def test_page_with_issuequery_block_and_no_settings
|
||
|
user = User.find(2)
|
||
|
user.pref.my_page_layout = {'top' => ['issuequery']}
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
def test_page_with_assigned_issues_block_and_should_not_display_closed_projects
|
||
|
user = User.find(2)
|
||
|
User.current = user
|
||
|
preferences = user.pref
|
||
|
preferences.my_page_settings = {'issuesassignedtome' => {:sort => "#{Issue.table_name}.id asc"}}
|
||
|
preferences.save!
|
||
|
Issue.update_all(:assigned_to_id => user.id)
|
||
|
query = IssueQuery.new(:name => 'label_assigned_to_me_issues', :user => User.current)
|
||
|
query.add_filter 'assigned_to_id', '=', ['me']
|
||
|
query.add_available_filter('project.status', :type => :integer)
|
||
|
query.add_filter 'project.status', '=', ["#{Project::STATUS_ACTIVE}"]
|
||
|
query.sort_criteria = [['id', 'asc']]
|
||
|
totalcount_issues = query.issue_count
|
||
|
project = Project.find_by_identifier('subproject1')
|
||
|
project.close
|
||
|
project.reload
|
||
|
totalcount_issues_without_closed_project = query.issue_count
|
||
|
display_issues = query.issues(:limit => 10)
|
||
|
assert_not_equal totalcount_issues_without_closed_project, totalcount_issues
|
||
|
get :page
|
||
|
assert_response :success
|
||
|
assert_select '#block-issuesassignedtome' do
|
||
|
assert_select 'h3', :text => /[\s\S]*\(#{totalcount_issues_without_closed_project}\)\z/m
|
||
|
assert_select 'table.issues' do
|
||
|
assert_select 'tr.issue', display_issues.count
|
||
|
display_issues.each_with_index do |issue, idx|
|
||
|
assert_select "tr.issue:nth-of-type(#{idx + 1})#issue-#{issue.id}"
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
def test_page_with_reported_issues_block_and_should_not_display_closed_projects
|
||
|
user = User.find(2)
|
||
|
User.current = user
|
||
|
preferences = user.pref
|
||
|
preferences.my_page_settings = {'issuesreportedbyme' => {:sort => "#{Issue.table_name}.id asc"}}
|
||
|
preferences.save!
|
||
|
query = IssueQuery.new(:name => 'label_reported_issues', :user => User.current)
|
||
|
query.add_filter 'author_id', '=', ['me']
|
||
|
query.add_available_filter('project.status', :type => :integer)
|
||
|
query.add_filter 'project.status', '=', ["#{Project::STATUS_ACTIVE}"]
|
||
|
query.sort_criteria = [['id', 'asc']]
|
||
|
totalcount_issues = query.issue_count
|
||
|
project = Project.find_by_identifier('subproject1')
|
||
|
project.close
|
||
|
project.reload
|
||
|
totalcount_issues_without_closed_project = query.issue_count
|
||
|
display_issues = query.issues(:limit => 10)
|
||
|
assert_not_equal totalcount_issues_without_closed_project, totalcount_issues
|
||
|
get :page
|
||
|
assert_response :success
|
||
|
assert_select '#block-issuesreportedbyme' do
|
||
|
assert_select 'h3', :text => /[\s\S]*\(#{totalcount_issues_without_closed_project}\)\z/m
|
||
|
assert_select 'table.issues' do
|
||
|
assert_select 'tr.issue', display_issues.count
|
||
|
display_issues.each_with_index do |issue, idx|
|
||
|
assert_select "tr.issue:nth-of-type(#{idx + 1})#issue-#{issue.id}"
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
def test_page_with_activity
|
||
|
user = User.find(2)
|
||
|
user.pref.my_page_layout = {'top' => ['activity']}
|
||
| ... | ... | |
|
:group_ids => ['10'],
|
||
|
:custom_field_values => {
|
||
|
"4" => "0100562500"
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
| ... | ... | |
|
post :account, :params => {
|
||
|
:user => {
|
||
|
:mail => 'foobar@example.com'
|
||
|
|
||
|
}
|
||
|
}
|
||
| ... | ... | |
|
post :update_page, :params => {
|
||
|
:settings => {
|
||
|
'issuesassignedtome' => {
|
||
|
'columns' => ['subject', 'due_date']}
|
||
|
'columns' => ['subject', 'due_date']}
|
||
|
}
|
||
|
},
|
||
|
:xhr => true
|
||
| ... | ... | |
|
pref = User.find(2).pref
|
||
|
pref.my_page_layout = {'left' => ['news', 'calendar','documents']}
|
||
|
pref.save!
|
||
|
|
||
|
post :order_blocks, :params => {
|
||
|
:group => 'left',
|
||
|
:blocks => ['documents', 'calendar', 'news']
|
||
| ... | ... | |
|
pref = User.find(2).pref
|
||
|
pref.my_page_layout = {'left' => ['news','documents'], 'right' => ['calendar']}
|
||
|
pref.save!
|
||
|
|
||
|
post :order_blocks, :params => {
|
||
|
:group => 'left',
|
||
|
:blocks => ['news', 'calendar', 'documents']
|
||