Optimize the way some large strings are created to speed up ticket_spec.rb.
This commit is contained in:
parent
7de5ec9037
commit
6f0d975c15
1 changed files with 4 additions and 4 deletions
|
@ -1856,7 +1856,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
Store.add(
|
Store.add(
|
||||||
object: 'SomeObject',
|
object: 'SomeObject',
|
||||||
o_id: 1,
|
o_id: 1,
|
||||||
data: (1024**800_000).to_s, # with 2.4 mb
|
data: 'a' * (1024**2 * 2.4), # with 2.4 mb
|
||||||
filename: 'test.TXT',
|
filename: 'test.TXT',
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
@ -1931,7 +1931,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
Store.add(
|
Store.add(
|
||||||
object: 'Ticket::Article',
|
object: 'Ticket::Article',
|
||||||
o_id: article1.id,
|
o_id: article1.id,
|
||||||
data: (1024**800_000).to_s, # with 2.4 mb
|
data: 'a' * (1024**2 * 2.4), # with 2.4 mb
|
||||||
filename: 'some_file.pdf',
|
filename: 'some_file.pdf',
|
||||||
preferences: {
|
preferences: {
|
||||||
'Content-Type' => 'image/pdf',
|
'Content-Type' => 'image/pdf',
|
||||||
|
@ -1941,14 +1941,14 @@ RSpec.describe Ticket, type: :model do
|
||||||
Store.add(
|
Store.add(
|
||||||
object: 'Ticket::Article',
|
object: 'Ticket::Article',
|
||||||
o_id: article1.id,
|
o_id: article1.id,
|
||||||
data: (1024**2_000_000).to_s, # with 5,8 mb
|
data: 'a' * (1024**2 * 5.8), # with 5,8 mb
|
||||||
filename: 'some_file.txt',
|
filename: 'some_file.txt',
|
||||||
preferences: {
|
preferences: {
|
||||||
'Content-Type' => 'text/plain',
|
'Content-Type' => 'text/plain',
|
||||||
},
|
},
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
create(:ticket_article, ticket: ticket, body: (1024**400_000).to_s.split(/(.{100})/).join(' ')) # body with 1,2 mb
|
create(:ticket_article, ticket: ticket, body: 'a' * (1024**2 * 1.2)) # body with 1,2 mb
|
||||||
create(:ticket_article, ticket: ticket)
|
create(:ticket_article, ticket: ticket)
|
||||||
ticket.search_index_attribute_lookup
|
ticket.search_index_attribute_lookup
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue