More test fixed for redmine 4
This commit is contained in:
parent
3421763669
commit
10fdd1fee7
@ -1 +0,0 @@
|
||||
functional
|
@ -9,25 +9,23 @@ class AccountControllerTest < Additionals::ControllerTest
|
||||
end
|
||||
|
||||
def test_get_login_with_welcome_text
|
||||
with_additionals_settings(account_login_bottom: 'Lore impsuum')
|
||||
|
||||
get :login
|
||||
assert_response :success
|
||||
|
||||
assert_select 'input[name=username]'
|
||||
assert_select 'input[name=password]'
|
||||
assert_select 'div.login-additionals', text: /Lore impsuum/
|
||||
with_additionals_settings(account_login_bottom: 'Lore impsuum') do
|
||||
get :login
|
||||
assert_response :success
|
||||
assert_select 'input[name=username]'
|
||||
assert_select 'input[name=password]'
|
||||
assert_select 'div.login-additionals', text: /Lore impsuum/
|
||||
end
|
||||
end
|
||||
|
||||
def test_get_login_without_welcome_text
|
||||
with_additionals_settings(account_login_bottom: '')
|
||||
|
||||
get :login
|
||||
assert_response :success
|
||||
|
||||
assert_select 'input[name=username]'
|
||||
assert_select 'input[name=password]'
|
||||
assert_select 'div.login-additionals', count: 0
|
||||
with_additionals_settings(account_login_bottom: '') do
|
||||
get :login
|
||||
assert_response :success
|
||||
assert_select 'input[name=username]'
|
||||
assert_select 'input[name=password]'
|
||||
assert_select 'div.login-additionals', count: 0
|
||||
end
|
||||
end
|
||||
|
||||
# See integration/account_test.rb for the full test
|
||||
|
@ -86,42 +86,47 @@ class IssuesControllerTest < Additionals::ControllerTest
|
||||
end
|
||||
|
||||
test 'show assign-to-me on issue' do
|
||||
with_additionals_settings(issue_assign_to_me: 1)
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
assert_select 'a.assign-to-me'
|
||||
with_additionals_settings(issue_assign_to_me: 1) do
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
assert_select 'a.assign-to-me'
|
||||
end
|
||||
end
|
||||
|
||||
test 'don\'t show assign-to-me on issue without activation' do
|
||||
with_additionals_settings(issue_assign_to_me: 0)
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
assert_select 'a.assign-to-me', count: 0
|
||||
with_additionals_settings(issue_assign_to_me: 0) do
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
assert_select 'a.assign-to-me', count: 0
|
||||
end
|
||||
end
|
||||
|
||||
test 'don\'t show assign-to-me on issue with already assigned_to me' do
|
||||
with_additionals_settings(issue_assign_to_me: 1)
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 4 }
|
||||
assert_select 'a.assign-to-me', count: 0
|
||||
with_additionals_settings(issue_assign_to_me: 1) do
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 4 }
|
||||
assert_select 'a.assign-to-me', count: 0
|
||||
end
|
||||
end
|
||||
|
||||
test 'show change status in issue sidebar' do
|
||||
with_additionals_settings(issue_change_status_in_sidebar: 1)
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
assert_select 'ul.issue-status-change-sidebar'
|
||||
with_additionals_settings(issue_change_status_in_sidebar: 1) do
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
assert_select 'ul.issue-status-change-sidebar'
|
||||
end
|
||||
end
|
||||
|
||||
test 'don\'t show change status in issue sidebar without activation' do
|
||||
with_additionals_settings(issue_change_status_in_sidebar: 0)
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
assert_select 'ul.issue-status-change-sidebar', count: 0
|
||||
with_additionals_settings(issue_change_status_in_sidebar: 0) do
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
assert_select 'ul.issue-status-change-sidebar', count: 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -20,22 +20,24 @@ class ProjectsControllerTest < Additionals::ControllerTest
|
||||
end
|
||||
|
||||
def test_show_overview_content
|
||||
with_additionals_settings(project_overview_content: 'Lore impsuum')
|
||||
@request.session[:user_id] = 4
|
||||
get :show,
|
||||
params: { id: 1 }
|
||||
with_additionals_settings(project_overview_content: 'Lore impsuum') do
|
||||
@request.session[:user_id] = 4
|
||||
get :show,
|
||||
params: { id: 1 }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.project-content', text: /Lore impsuum/
|
||||
assert_response :success
|
||||
assert_select 'div.project-content', text: /Lore impsuum/
|
||||
end
|
||||
end
|
||||
|
||||
def test_do_not_show_overview_content_box
|
||||
with_additionals_settings(project_overview_content: '')
|
||||
@request.session[:user_id] = 4
|
||||
get :show,
|
||||
params: { id: 1 }
|
||||
with_additionals_settings(project_overview_content: '') do
|
||||
@request.session[:user_id] = 4
|
||||
get :show,
|
||||
params: { id: 1 }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.project-content', count: 0
|
||||
assert_response :success
|
||||
assert_select 'div.project-content', count: 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -23,18 +23,20 @@ class UsersControllerTest < Additionals::ControllerTest
|
||||
end
|
||||
|
||||
def test_show_new_issue_on_profile
|
||||
with_additionals_settings(new_issue_on_profile: 1)
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
assert_select 'a.user-new-issue'
|
||||
with_additionals_settings(new_issue_on_profile: 1) do
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
assert_select 'a.user-new-issue'
|
||||
end
|
||||
end
|
||||
|
||||
def test_not_show_new_issue_on_profile_without_activated
|
||||
with_additionals_settings(new_issue_on_profile: 0)
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
assert_select 'a.user-new-issue', count: 0
|
||||
with_additionals_settings(new_issue_on_profile: 0) do
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
assert_select 'a.user-new-issue', count: 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -9,56 +9,62 @@ class WelcomeControllerTest < Additionals::ControllerTest
|
||||
end
|
||||
|
||||
def test_show_with_overview_right
|
||||
with_additionals_settings(overview_right: 'Lore impsuum')
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
with_additionals_settings(overview_right: 'Lore impsuum') do
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.overview-right', text: /Lore impsuum/
|
||||
assert_response :success
|
||||
assert_select 'div.overview-right', text: /Lore impsuum/
|
||||
end
|
||||
end
|
||||
|
||||
def test_show_without_overview_right
|
||||
with_additionals_settings(overview_right: '')
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
with_additionals_settings(overview_right: '') do
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.overview-right', count: 0
|
||||
assert_response :success
|
||||
assert_select 'div.overview-right', count: 0
|
||||
end
|
||||
end
|
||||
|
||||
def test_show_with_overview_bottom
|
||||
with_additionals_settings(overview_bottom: 'Lore impsuum')
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
with_additionals_settings(overview_bottom: 'Lore impsuum') do
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.overview-bottom', text: /Lore impsuum/
|
||||
assert_response :success
|
||||
assert_select 'div.overview-bottom', text: /Lore impsuum/
|
||||
end
|
||||
end
|
||||
|
||||
def test_show_without_overview_bottom
|
||||
with_additionals_settings(overview_bottom: '')
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
with_additionals_settings(overview_bottom: '') do
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.overview-bottom', count: 0
|
||||
assert_response :success
|
||||
assert_select 'div.overview-bottom', count: 0
|
||||
end
|
||||
end
|
||||
|
||||
def test_show_with_overview_top
|
||||
with_additionals_settings(overview_top: 'Lore impsuum')
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
with_additionals_settings(overview_top: 'Lore impsuum') do
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.overview-top', text: /Lore impsuum/
|
||||
assert_response :success
|
||||
assert_select 'div.overview-top', text: /Lore impsuum/
|
||||
end
|
||||
end
|
||||
|
||||
def test_show_without_overview_top
|
||||
with_additionals_settings(overview_top: '')
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
with_additionals_settings(overview_top: '') do
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.overview-top', count: 0
|
||||
assert_response :success
|
||||
assert_select 'div.overview-top', count: 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -368,42 +368,42 @@ class WikiControllerTest < Additionals::ControllerTest
|
||||
end
|
||||
|
||||
def test_show_wiki_with_header
|
||||
with_additionals_settings(global_wiki_header: 'Lore impsuum')
|
||||
with_additionals_settings(global_wiki_header: 'Lore impsuum') do
|
||||
get :show,
|
||||
params: { project_id: 1, id: 'Another_page' }
|
||||
|
||||
get :show,
|
||||
params: { project_id: 1, id: 'Another_page' }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div#wiki_extentions_header', text: /Lore impsuum/
|
||||
assert_response :success
|
||||
assert_select 'div#wiki_extentions_header', text: /Lore impsuum/
|
||||
end
|
||||
end
|
||||
|
||||
def test_show_wiki_without_header
|
||||
with_additionals_settings(global_wiki_header: '')
|
||||
with_additionals_settings(global_wiki_header: '') do
|
||||
get :show,
|
||||
params: { project_id: 1, id: 'Another_page' }
|
||||
|
||||
get :show,
|
||||
params: { project_id: 1, id: 'Another_page' }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div#wiki_extentions_header', count: 0
|
||||
assert_response :success
|
||||
assert_select 'div#wiki_extentions_header', count: 0
|
||||
end
|
||||
end
|
||||
|
||||
def test_show_wiki_with_footer
|
||||
with_additionals_settings(global_wiki_footer: 'Lore impsuum')
|
||||
with_additionals_settings(global_wiki_footer: 'Lore impsuum') do
|
||||
get :show,
|
||||
params: { project_id: 1, id: 'Another_page' }
|
||||
|
||||
get :show,
|
||||
params: { project_id: 1, id: 'Another_page' }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div#wiki_extentions_footer', text: /Lore impsuum/
|
||||
assert_response :success
|
||||
assert_select 'div#wiki_extentions_footer', text: /Lore impsuum/
|
||||
end
|
||||
end
|
||||
|
||||
def test_show_wiki_without_footer
|
||||
with_additionals_settings(global_wiki_footer: '')
|
||||
with_additionals_settings(global_wiki_footer: '') do
|
||||
get :show,
|
||||
params: { project_id: 1, id: 'Another_page' }
|
||||
|
||||
get :show,
|
||||
params: { project_id: 1, id: 'Another_page' }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div#wiki_extentions_footer', count: 0
|
||||
assert_response :success
|
||||
assert_select 'div#wiki_extentions_footer', count: 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -42,61 +42,61 @@ module ApiTest
|
||||
with_additionals_settings(issue_status_change: '0',
|
||||
issue_auto_assign: '0',
|
||||
issue_auto_assign_status: ['1'],
|
||||
issue_auto_assign_role: '1')
|
||||
issue_auto_assign_role: '1') do
|
||||
payload = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<issue>
|
||||
<project_id>1</project_id>
|
||||
<tracker_id>2</tracker_id>
|
||||
<status_id>3</status_id>
|
||||
<subject>API test</subject>
|
||||
</issue>
|
||||
XML
|
||||
|
||||
payload = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<issue>
|
||||
<project_id>1</project_id>
|
||||
<tracker_id>2</tracker_id>
|
||||
<status_id>3</status_id>
|
||||
<subject>API test</subject>
|
||||
</issue>
|
||||
XML
|
||||
assert_difference('Issue.count') do
|
||||
post '/issues.xml',
|
||||
params: payload,
|
||||
headers: { 'CONTENT_TYPE' => 'application/xml' }.merge(credentials('jsmith'))
|
||||
end
|
||||
issue = Issue.order(id: :desc).first
|
||||
assert_equal 1, issue.project_id
|
||||
assert_nil issue.assigned_to_id
|
||||
assert_equal 'API test', issue.subject
|
||||
|
||||
assert_difference('Issue.count') do
|
||||
post '/issues.xml',
|
||||
params: payload,
|
||||
headers: { 'CONTENT_TYPE' => 'application/xml' }.merge(credentials('jsmith'))
|
||||
assert_response :created
|
||||
assert_equal 'application/xml', @response.content_type
|
||||
assert_select 'issue > id', text: issue.id.to_s
|
||||
end
|
||||
issue = Issue.order(id: :desc).first
|
||||
assert_equal 1, issue.project_id
|
||||
assert_nil issue.assigned_to_id
|
||||
assert_equal 'API test', issue.subject
|
||||
|
||||
assert_response :created
|
||||
assert_equal 'application/xml', @response.content_type
|
||||
assert_select 'issue > id', text: issue.id.to_s
|
||||
end
|
||||
|
||||
test 'POST /issues.xml should create an issue with auto assigned_to_id' do
|
||||
with_additionals_settings(issue_status_change: '0',
|
||||
issue_auto_assign: '1',
|
||||
issue_auto_assign_status: ['1'],
|
||||
issue_auto_assign_role: '1')
|
||||
issue_auto_assign_role: '1') do
|
||||
payload = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<issue>
|
||||
<project_id>1</project_id>
|
||||
<subject>API test</subject>
|
||||
</issue>
|
||||
XML
|
||||
|
||||
payload = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<issue>
|
||||
<project_id>1</project_id>
|
||||
<subject>API test</subject>
|
||||
</issue>
|
||||
XML
|
||||
assert_difference('Issue.count') do
|
||||
post '/issues.xml',
|
||||
params: payload,
|
||||
headers: { 'CONTENT_TYPE' => 'application/xml' }.merge(credentials('jsmith'))
|
||||
end
|
||||
|
||||
assert_difference('Issue.count') do
|
||||
post '/issues.xml',
|
||||
params: payload,
|
||||
headers: { 'CONTENT_TYPE' => 'application/xml' }.merge(credentials('jsmith'))
|
||||
issue = Issue.order(id: :desc).first
|
||||
assert_equal 1, issue.project_id
|
||||
assert_equal 2, issue.assigned_to_id
|
||||
assert_equal 'API test', issue.subject
|
||||
|
||||
assert_response :created
|
||||
assert_equal 'application/xml', @response.content_type
|
||||
assert_select 'issue > id', text: issue.id.to_s
|
||||
end
|
||||
|
||||
issue = Issue.order(id: :desc).first
|
||||
assert_equal 1, issue.project_id
|
||||
assert_equal 2, issue.assigned_to_id
|
||||
assert_equal 'API test', issue.subject
|
||||
|
||||
assert_response :created
|
||||
assert_equal 'application/xml', @response.content_type
|
||||
assert_select 'issue > id', text: issue.id.to_s
|
||||
end
|
||||
|
||||
test 'DELETE /issues/:id.xml' do
|
||||
|
@ -17,8 +17,11 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper')
|
||||
|
||||
module Additionals
|
||||
module TestHelper
|
||||
def with_additionals_settings(settings)
|
||||
def with_additionals_settings(settings, &_block)
|
||||
Additionals.change_settings = settings
|
||||
yield
|
||||
ensure
|
||||
Additionals.change_settings = Setting[:plugin_additionals]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -67,21 +67,21 @@ class IssueTest < ActiveSupport::TestCase
|
||||
with_additionals_settings(issue_status_change: '0',
|
||||
issue_auto_assign: '1',
|
||||
issue_auto_assign_status: ['1'],
|
||||
issue_auto_assign_role: '1')
|
||||
|
||||
issue = Issue.new(project_id: 1, tracker_id: 1, author_id: 3, subject: 'test_create')
|
||||
assert issue.save
|
||||
assert_equal 2, issue.assigned_to_id
|
||||
issue_auto_assign_role: '1') do
|
||||
issue = Issue.new(project_id: 1, tracker_id: 1, author_id: 3, subject: 'test_create')
|
||||
assert issue.save
|
||||
assert_equal 2, issue.assigned_to_id
|
||||
end
|
||||
end
|
||||
|
||||
def test_disabled_auto_assigned_to
|
||||
with_additionals_settings(issue_status_change: '0',
|
||||
issue_auto_assign: '0',
|
||||
issue_auto_assign_status: ['1'],
|
||||
issue_auto_assign_role: '1')
|
||||
|
||||
issue = Issue.new(project_id: 1, tracker_id: 1, author_id: 3, subject: 'test_create')
|
||||
assert issue.save
|
||||
assert_nil issue.assigned_to_id
|
||||
issue_auto_assign_role: '1') do
|
||||
issue = Issue.new(project_id: 1, tracker_id: 1, author_id: 3, subject: 'test_create')
|
||||
assert issue.save
|
||||
assert_nil issue.assigned_to_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -11,83 +11,93 @@ class WatcherTest < ActiveSupport::TestCase
|
||||
@author = User.find(1)
|
||||
@assigned_user = User.find(2)
|
||||
@changing_user = User.find(4)
|
||||
with_additionals_settings(issue_autowatch_involved: 1)
|
||||
end
|
||||
|
||||
def test_new_issue_with_no_autowatch
|
||||
with_additionals_settings(issue_autowatch_involved: 0)
|
||||
User.current = @author
|
||||
issue = Issue.generate(author_id: @author.id)
|
||||
issue.save
|
||||
assert_equal 0, issue.watchers.count
|
||||
assert_not issue.watched_by?(@author)
|
||||
with_additionals_settings(issue_autowatch_involved: 0) do
|
||||
User.current = @author
|
||||
issue = Issue.generate(author_id: @author.id)
|
||||
issue.save
|
||||
assert_equal 0, issue.watchers.count
|
||||
assert_not issue.watched_by?(@author)
|
||||
end
|
||||
end
|
||||
|
||||
def test_new_issue_with_no_autowatch_by_user
|
||||
User.current = @author
|
||||
User.current.pref.update_attribute :autowatch_involved_issue, false
|
||||
with_additionals_settings(issue_autowatch_involved: 1) do
|
||||
User.current = @author
|
||||
User.current.pref.update_attribute :autowatch_involved_issue, false
|
||||
|
||||
issue = Issue.generate(author_id: @author.id)
|
||||
issue.save
|
||||
assert_equal 0, issue.watchers.count
|
||||
assert_not issue.watched_by?(@author)
|
||||
issue = Issue.generate(author_id: @author.id)
|
||||
issue.save
|
||||
assert_equal 0, issue.watchers.count
|
||||
assert_not issue.watched_by?(@author)
|
||||
end
|
||||
end
|
||||
|
||||
def test_new_issue_with_author_watch_only
|
||||
User.current = @author
|
||||
issue = Issue.generate(author_id: @author.id)
|
||||
issue.save
|
||||
assert_equal 1, issue.watchers.count
|
||||
assert issue.watched_by?(@author)
|
||||
with_additionals_settings(issue_autowatch_involved: 1) do
|
||||
User.current = @author
|
||||
issue = Issue.generate(author_id: @author.id)
|
||||
issue.save
|
||||
assert_equal 1, issue.watchers.count
|
||||
assert issue.watched_by?(@author)
|
||||
end
|
||||
end
|
||||
|
||||
def test_new_issue_with_author_and_assigned_to_watchers
|
||||
User.current = @author
|
||||
issue = Issue.generate(author_id: @author.id, assigned_to: @assigned_user)
|
||||
issue.save
|
||||
with_additionals_settings(issue_autowatch_involved: 1) do
|
||||
User.current = @author
|
||||
issue = Issue.generate(author_id: @author.id, assigned_to: @assigned_user)
|
||||
issue.save
|
||||
|
||||
assert_equal 2, issue.watchers.count
|
||||
assert issue.watched_by?(@author)
|
||||
assert issue.watched_by?(@assigned_user)
|
||||
assert_equal 2, issue.watchers.count
|
||||
assert issue.watched_by?(@author)
|
||||
assert issue.watched_by?(@assigned_user)
|
||||
end
|
||||
end
|
||||
|
||||
def test_issue_do_not_add_author_with_user_change
|
||||
User.current = @author
|
||||
with_additionals_settings(issue_autowatch_involved: 1) do
|
||||
User.current = @author
|
||||
|
||||
issue = Issue.generate(author_id: @author.id, assigned_to: @assigned_user)
|
||||
issue.save
|
||||
assert_equal 2, issue.watchers.count
|
||||
issue = Issue.generate(author_id: @author.id, assigned_to: @assigned_user)
|
||||
issue.save
|
||||
assert_equal 2, issue.watchers.count
|
||||
|
||||
issue.remove_watcher(@author)
|
||||
issue.reload
|
||||
assert_equal 1, issue.watchers.count
|
||||
issue.remove_watcher(@author)
|
||||
issue.reload
|
||||
assert_equal 1, issue.watchers.count
|
||||
|
||||
User.current = @changing_user
|
||||
issue.subject = 'Changing....'
|
||||
issue.save
|
||||
User.current = @changing_user
|
||||
issue.subject = 'Changing....'
|
||||
issue.save
|
||||
|
||||
assert_equal 2, issue.watchers.count
|
||||
assert issue.watched_by?(@changing_user)
|
||||
assert issue.watched_by?(@assigned_user)
|
||||
assert_equal 2, issue.watchers.count
|
||||
assert issue.watched_by?(@changing_user)
|
||||
assert issue.watched_by?(@assigned_user)
|
||||
end
|
||||
end
|
||||
|
||||
def test_issue_do_not_add_assigned_to_with_user_change
|
||||
User.current = @author
|
||||
with_additionals_settings(issue_autowatch_involved: 1) do
|
||||
User.current = @author
|
||||
|
||||
issue = Issue.generate(author_id: @author.id, assigned_to: @assigned_user)
|
||||
issue.save
|
||||
assert_equal 2, issue.watchers.count
|
||||
issue = Issue.generate(author_id: @author.id, assigned_to: @assigned_user)
|
||||
issue.save
|
||||
assert_equal 2, issue.watchers.count
|
||||
|
||||
issue.remove_watcher(@assigned_user)
|
||||
issue.reload
|
||||
assert_equal 1, issue.watchers.count
|
||||
issue.remove_watcher(@assigned_user)
|
||||
issue.reload
|
||||
assert_equal 1, issue.watchers.count
|
||||
|
||||
User.current = @changing_user
|
||||
issue.subject = 'Changing....'
|
||||
issue.save
|
||||
User.current = @changing_user
|
||||
issue.subject = 'Changing....'
|
||||
issue.save
|
||||
|
||||
assert_equal 2, issue.watchers.count
|
||||
assert issue.watched_by?(@author)
|
||||
assert issue.watched_by?(@changing_user)
|
||||
assert_equal 2, issue.watchers.count
|
||||
assert issue.watched_by?(@author)
|
||||
assert issue.watched_by?(@changing_user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user