fix test ruby

This commit is contained in:
Guillermo 2019-07-01 20:38:34 -03:00
parent 94a8cd4431
commit 69d0c58172
5 changed files with 22 additions and 11 deletions

View File

@ -30,7 +30,7 @@ class EmailPollingController extends Controller {
throw new RequestException(ERRORS::INVALID_TOKEN);
if(Controller::isUserSystemEnabled())
throw new RequestException(ERRORS::USER_SYSTEM);
throw new RequestException(ERRORS::USER_SYSTEM_ENABLED);
$this->mailbox = new \PhpImap\Mailbox(
Setting::getSetting('imap-host')->getValue(),

View File

@ -95,7 +95,7 @@ class CommentController extends Controller {
'staff' => true
]);
} else if($isOwner) {
$this->sendMail($ticketAuthor);
!Controller::request('private') ? $this->sendMail($ticketAuthor) : null;
}
Log::createLog('COMMENT', $this->ticket->ticketNumber);
@ -151,12 +151,12 @@ class CommentController extends Controller {
}
$mailSender->setTemplate(MailTemplate::TICKET_RESPONDED, [
'to' => $email,
'name' => $name,
'title' => $this->ticket->title,
'ticketNumber' => $this->ticket->ticketNumber,
'content' => $this->content,
'url' => $url
'to' => $email,
'name' => $name,
'title' => $this->ticket->title,
'ticketNumber' => $this->ticket->ticketNumber,
'content' => $this->content,
'url' => $url
]);
$mailSender->send();

View File

@ -62,6 +62,7 @@ class EditCommentController extends Controller {
$ticket->store();
}
Response::respondSuccess();
}
}

View File

@ -115,6 +115,13 @@ class Scripts
color: color
})
end
def self.assignTicket(ticketnumber)
request('/staff/assign-ticket', {
ticketNumber: ticketnumber,
csrf_userid: $csrf_userid,
csrf_token: $csrf_token
})
end
def self.commentTicket(ticketnumber,content)
request('/ticket/comment', {
content: content,

View File

@ -71,12 +71,15 @@ describe '/ticket/edit-comment' do
it 'should not change the content of a comment if the user is not the author' do
request('/user/logout')
Scripts.login($staff[:email], $staff[:password], true)
ticket = $database.getRow('ticket', 'ticket made by an user', 'title')
Scripts.commentTicket(ticket['ticket_number'],'comment by a staffffff')
ticketevent = $database.getRow('ticketevent', 'comment by a staffffff', 'content')
Scripts.assignTicket(ticket['ticket_number'])
Scripts.commentTicket(ticket['ticket_number'],'this is a new comment of a staff member')
ticketevent = $database.getRow('ticketevent', 'this is a new comment of a staff member', 'content')
request('/user/logout')
Scripts.login();
@ -84,7 +87,7 @@ describe '/ticket/edit-comment' do
result = request('/ticket/edit-comment', {
csrf_userid: $csrf_userid,
csrf_token: $csrf_token,
content: 'comment edited by a user',
content: 'comment edited by an user',
ticketEventId: ticketevent['id']
})
(result['status']).should.equal('fail')