Fixed bug: RSpec tests are broken because of not using RSpec hooks and structures.
This commit is contained in:
parent
f3e20bca29
commit
7d9c087a84
3 changed files with 26 additions and 17 deletions
13
spec/factories/taskbar.rb
Normal file
13
spec/factories/taskbar.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
FactoryBot.define do
|
||||
factory :taskbar do
|
||||
client_id 123
|
||||
key 'Ticket-1234'
|
||||
add_attribute(:callback) { 'TicketZoom' }
|
||||
params do
|
||||
{}
|
||||
end
|
||||
state {}
|
||||
prio 1
|
||||
notify false
|
||||
end
|
||||
end
|
|
@ -3,20 +3,16 @@ require 'rails_helper'
|
|||
RSpec.describe Taskbar do
|
||||
|
||||
context 'single creation' do
|
||||
Taskbar.destroy_all
|
||||
UserInfo.current_user_id = 1
|
||||
|
||||
taskbar = Taskbar.create(
|
||||
client_id: 123,
|
||||
key: 'Ticket-1234',
|
||||
callback: 'TicketZoom',
|
||||
params: {
|
||||
id: 1234,
|
||||
},
|
||||
state: {},
|
||||
prio: 1,
|
||||
notify: false,
|
||||
)
|
||||
let(:taskbar) do
|
||||
|
||||
Taskbar.destroy_all
|
||||
UserInfo.current_user_id = 1
|
||||
|
||||
create(:taskbar, params: {
|
||||
id: 1234,
|
||||
})
|
||||
end
|
||||
|
||||
it 'existing key' do
|
||||
expect(taskbar.key).to eq('Ticket-1234')
|
||||
|
@ -79,8 +75,6 @@ RSpec.describe Taskbar do
|
|||
expect(taskbar.last_contact.to_s).not_to eq(last_contact1.to_s)
|
||||
expect(taskbar.last_contact.to_s).not_to eq(last_contact2.to_s)
|
||||
end
|
||||
|
||||
UserInfo.current_user_id = nil
|
||||
end
|
||||
|
||||
context 'multible creation' do
|
||||
|
|
|
@ -2,8 +2,10 @@ require 'rails_helper'
|
|||
|
||||
RSpec.describe Translation do
|
||||
|
||||
Translation.where(locale: 'de-de').destroy_all
|
||||
Translation.sync('de-de')
|
||||
before(:all) do
|
||||
Translation.where(locale: 'de-de').destroy_all
|
||||
Translation.sync('de-de')
|
||||
end
|
||||
|
||||
context 'default translations' do
|
||||
|
||||
|
|
Loading…
Reference in a new issue