| 1993 |
1993 |
principals_options_for_select(users)
|
| 1994 |
1994 |
end
|
| 1995 |
1995 |
|
| 1996 |
|
def test_principals_options_for_select_should_include_author_and_previous_assignee
|
|
1996 |
def test_principals_options_for_select_should_include_author_previous_assignee_and_last_notes_author
|
| 1997 |
1997 |
set_language_if_valid 'en'
|
| 1998 |
|
users = [User.find(2), User.find(3), User.find(1)]
|
|
1998 |
users = [User.find(2), User.find(3), User.find(1), User.find(4)]
|
| 1999 |
1999 |
@issue = Issue.generate!(author_id: 1, assigned_to_id: 2)
|
| 2000 |
2000 |
@issue.init_journal(users.first, 'update')
|
| 2001 |
2001 |
@issue.assigned_to_id = 3
|
| 2002 |
2002 |
@issue.save
|
|
2003 |
Journal.create!(:journalized => @issue, :user_id => 4, :notes => 'Last notes')
|
| 2003 |
2004 |
|
| 2004 |
2005 |
result = principals_options_for_select(users)
|
| 2005 |
|
assert_select_in result, 'optgroup[label="Author / Previous assignee"]' do
|
|
2006 |
assert_select_in result, 'optgroup[label="Author / Recent participants"]' do
|
| 2006 |
2007 |
assert_select 'option:nth-of-type(1)', text: 'Redmine Admin' # Author
|
| 2007 |
2008 |
assert_select 'option:nth-of-type(2)', text: 'John Smith' # Prior assignee
|
|
2009 |
assert_select 'option:nth-of-type(3)', text: 'Robert Hill' # Last notes author
|
| 2008 |
2010 |
end
|
| 2009 |
2011 |
end
|
| 2010 |
2012 |
|
|
2013 |
def test_principals_options_for_select_should_not_include_private_last_notes_author_without_permission
|
|
2014 |
set_language_if_valid 'en'
|
|
2015 |
User.current = User.find(3)
|
|
2016 |
users = [User.find(2), User.find(3), User.find(1), User.find(4)]
|
|
2017 |
@issue = Issue.generate!(author_id: 1, assigned_to_id: 2)
|
|
2018 |
@issue.init_journal(users.first, 'update')
|
|
2019 |
@issue.assigned_to_id = 3
|
|
2020 |
@issue.save
|
|
2021 |
Journal.create!(:journalized => @issue, :user_id => 4, :notes => 'Public notes')
|
|
2022 |
Journal.create!(:journalized => @issue, :user_id => 8, :notes => 'Private notes', :private_notes => true)
|
|
2023 |
|
|
2024 |
result = principals_options_for_select(users)
|
|
2025 |
assert_select_in result, 'optgroup[label="Author / Recent participants"]' do
|
|
2026 |
assert_select 'option:nth-of-type(1)', text: 'Redmine Admin'
|
|
2027 |
assert_select 'option:nth-of-type(2)', text: 'John Smith'
|
|
2028 |
assert_select 'option:nth-of-type(3)', text: 'Robert Hill'
|
|
2029 |
end
|
|
2030 |
ensure
|
|
2031 |
User.current = nil
|
|
2032 |
end
|
|
2033 |
|
| 2011 |
2034 |
def test_stylesheet_link_tag_should_pick_the_default_stylesheet
|
| 2012 |
2035 |
assert_match 'href="/assets/styles.css"', stylesheet_link_tag("styles")
|
| 2013 |
2036 |
end
|