Fixed test: Ensure action is performed by current Ticket Owner to mark it as seen.

This commit is contained in:
Thorsten Eckel 2020-07-31 15:41:26 +02:00
parent b81d31a42f
commit cdbcb5d853
2 changed files with 4 additions and 2 deletions

View file

@ -12,7 +12,7 @@ RSpec.describe TicketOnlineNotificationSeenJob, type: :job do
expect(online_notification.reload.seen).to be false
end
it 'checks if online notification has been seen' do
it 'checks if online notification has been seen', current_user_id: -> { user.id } do
ticket.state_id = Ticket::State.lookup(name: 'closed').id
ticket.save!

View file

@ -7,10 +7,12 @@
# DB ForeignKey violation errors.
# If a `:current_user_id` metadata argument is set the initial value for
# UserInfo.current_user_id will be set to the arguments given value
# if it's a Proc it will get evaluated
RSpec.configure do |config|
config.before(:each) do |example|
UserInfo.current_user_id = example.metadata[:current_user_id]
current_user_id = example.metadata[:current_user_id]
UserInfo.current_user_id = current_user_id.is_a?(Proc) ? instance_exec(&current_user_id) : current_user_id
end
config.after(:each) do |_example|