Made spec indenpenent of user id.
This commit is contained in:
parent
1897e3a76c
commit
dbcac7083c
1 changed files with 21 additions and 19 deletions
|
@ -159,7 +159,9 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar3.preferences[:tasks][0][:user_id]).to eq(2)
|
||||
expect(taskbar3.preferences[:tasks][0][:changed]).to eq(false)
|
||||
|
||||
UserInfo.current_user_id = 3
|
||||
agent_user_id = create(:agent_user).id
|
||||
UserInfo.current_user_id = agent_user_id
|
||||
|
||||
taskbar4 = Taskbar.create(
|
||||
client_id: 123,
|
||||
key: 'Ticket-1234',
|
||||
|
@ -178,7 +180,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar1.preferences[:tasks][0][:changed]).to eq(false)
|
||||
expect(taskbar1.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar1.preferences[:tasks][1][:changed]).to eq(false)
|
||||
expect(taskbar1.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar1.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar1.preferences[:tasks][2][:changed]).to eq(false)
|
||||
|
||||
taskbar2.reload
|
||||
|
@ -187,7 +189,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar2.preferences[:tasks][0][:changed]).to eq(false)
|
||||
expect(taskbar2.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar2.preferences[:tasks][1][:changed]).to eq(false)
|
||||
expect(taskbar2.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar2.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar2.preferences[:tasks][2][:changed]).to eq(false)
|
||||
|
||||
taskbar3.reload
|
||||
|
@ -201,7 +203,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar4.preferences[:tasks][0][:changed]).to eq(false)
|
||||
expect(taskbar4.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar4.preferences[:tasks][1][:changed]).to eq(false)
|
||||
expect(taskbar4.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar4.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar4.preferences[:tasks][2][:changed]).to eq(false)
|
||||
|
||||
UserInfo.current_user_id = 2
|
||||
|
@ -214,7 +216,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar1.preferences[:tasks][0][:changed]).to eq(false)
|
||||
expect(taskbar1.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar1.preferences[:tasks][1][:changed]).to eq(false)
|
||||
expect(taskbar1.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar1.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar1.preferences[:tasks][2][:changed]).to eq(false)
|
||||
|
||||
taskbar2.reload
|
||||
|
@ -223,7 +225,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar2.preferences[:tasks][0][:changed]).to eq(false)
|
||||
expect(taskbar2.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar2.preferences[:tasks][1][:changed]).to eq(false)
|
||||
expect(taskbar2.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar2.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar2.preferences[:tasks][2][:changed]).to eq(false)
|
||||
|
||||
taskbar3.reload
|
||||
|
@ -237,7 +239,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar4.preferences[:tasks][0][:changed]).to eq(false)
|
||||
expect(taskbar4.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar4.preferences[:tasks][1][:changed]).to eq(false)
|
||||
expect(taskbar4.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar4.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar4.preferences[:tasks][2][:changed]).to eq(false)
|
||||
|
||||
UserInfo.current_user_id = 2
|
||||
|
@ -250,7 +252,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar1.preferences[:tasks][0][:changed]).to eq(false)
|
||||
expect(taskbar1.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar1.preferences[:tasks][1][:changed]).to eq(true)
|
||||
expect(taskbar1.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar1.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar1.preferences[:tasks][2][:changed]).to eq(false)
|
||||
|
||||
taskbar2.reload
|
||||
|
@ -259,7 +261,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar2.preferences[:tasks][0][:changed]).to eq(false)
|
||||
expect(taskbar2.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar2.preferences[:tasks][1][:changed]).to eq(true)
|
||||
expect(taskbar2.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar2.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar2.preferences[:tasks][2][:changed]).to eq(false)
|
||||
|
||||
taskbar3.reload
|
||||
|
@ -273,7 +275,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar4.preferences[:tasks][0][:changed]).to eq(false)
|
||||
expect(taskbar4.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar4.preferences[:tasks][1][:changed]).to eq(true)
|
||||
expect(taskbar4.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar4.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar4.preferences[:tasks][2][:changed]).to eq(false)
|
||||
|
||||
UserInfo.current_user_id = 1
|
||||
|
@ -286,7 +288,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar1.preferences[:tasks][0][:changed]).to eq(true)
|
||||
expect(taskbar1.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar1.preferences[:tasks][1][:changed]).to eq(true)
|
||||
expect(taskbar1.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar1.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar1.preferences[:tasks][2][:changed]).to eq(false)
|
||||
|
||||
taskbar2.reload
|
||||
|
@ -295,7 +297,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar2.preferences[:tasks][0][:changed]).to eq(true)
|
||||
expect(taskbar2.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar2.preferences[:tasks][1][:changed]).to eq(true)
|
||||
expect(taskbar2.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar2.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar2.preferences[:tasks][2][:changed]).to eq(false)
|
||||
|
||||
taskbar3.reload
|
||||
|
@ -309,7 +311,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar4.preferences[:tasks][0][:changed]).to eq(true)
|
||||
expect(taskbar4.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar4.preferences[:tasks][1][:changed]).to eq(true)
|
||||
expect(taskbar4.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar4.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar4.preferences[:tasks][2][:changed]).to eq(false)
|
||||
|
||||
taskbar1_last_contact = taskbar1.last_contact.to_s
|
||||
|
@ -331,7 +333,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar1.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar1.preferences[:tasks][1][:changed]).to eq(true)
|
||||
expect(taskbar1.preferences[:tasks][1][:last_contact].to_s).to eq(taskbar2_last_contact)
|
||||
expect(taskbar1.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar1.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar1.preferences[:tasks][2][:changed]).to eq(false)
|
||||
expect(taskbar1.preferences[:tasks][2][:last_contact].to_s).to eq(taskbar4_last_contact)
|
||||
|
||||
|
@ -343,7 +345,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar2.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar2.preferences[:tasks][1][:changed]).to eq(true)
|
||||
expect(taskbar2.preferences[:tasks][1][:last_contact].to_s).to eq(taskbar2_last_contact)
|
||||
expect(taskbar2.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar2.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar2.preferences[:tasks][2][:changed]).to eq(false)
|
||||
expect(taskbar2.preferences[:tasks][2][:last_contact].to_s).to eq(taskbar4_last_contact)
|
||||
|
||||
|
@ -361,7 +363,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar4.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar4.preferences[:tasks][1][:changed]).to eq(true)
|
||||
expect(taskbar4.preferences[:tasks][1][:last_contact].to_s).to eq(taskbar2_last_contact)
|
||||
expect(taskbar4.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar4.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar4.preferences[:tasks][2][:changed]).to eq(false)
|
||||
expect(taskbar4.preferences[:tasks][2][:last_contact].to_s).to eq(taskbar4_last_contact)
|
||||
|
||||
|
@ -378,7 +380,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar1.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar1.preferences[:tasks][1][:changed]).to eq(true)
|
||||
expect(taskbar1.preferences[:tasks][1][:last_contact].to_s).not_to eq(taskbar2_last_contact)
|
||||
expect(taskbar1.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar1.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar1.preferences[:tasks][2][:changed]).to eq(false)
|
||||
expect(taskbar1.preferences[:tasks][2][:last_contact].to_s).to eq(taskbar4_last_contact)
|
||||
|
||||
|
@ -390,7 +392,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar2.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar2.preferences[:tasks][1][:changed]).to eq(true)
|
||||
expect(taskbar2.preferences[:tasks][1][:last_contact].to_s).not_to eq(taskbar2_last_contact)
|
||||
expect(taskbar2.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar2.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar2.preferences[:tasks][2][:changed]).to eq(false)
|
||||
expect(taskbar2.preferences[:tasks][2][:last_contact].to_s).to eq(taskbar4_last_contact)
|
||||
|
||||
|
@ -408,7 +410,7 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar4.preferences[:tasks][1][:user_id]).to eq(2)
|
||||
expect(taskbar4.preferences[:tasks][1][:changed]).to eq(true)
|
||||
expect(taskbar4.preferences[:tasks][1][:last_contact].to_s).not_to eq(taskbar2_last_contact)
|
||||
expect(taskbar4.preferences[:tasks][2][:user_id]).to eq(3)
|
||||
expect(taskbar4.preferences[:tasks][2][:user_id]).to eq(agent_user_id)
|
||||
expect(taskbar4.preferences[:tasks][2][:changed]).to eq(false)
|
||||
expect(taskbar4.preferences[:tasks][2][:last_contact].to_s).to eq(taskbar4_last_contact)
|
||||
|
||||
|
|
Loading…
Reference in a new issue