Maintenance: Bump rubocop-rspec from 2.4.0 to 2.5.0
This commit is contained in:
parent
afd8557427
commit
183f89f810
21 changed files with 89 additions and 87 deletions
|
@ -520,9 +520,8 @@ GEM
|
|||
activesupport (>= 4.2.0)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 1.7.0, < 2.0)
|
||||
rubocop-rspec (2.4.0)
|
||||
rubocop (~> 1.0)
|
||||
rubocop-ast (>= 1.1.0)
|
||||
rubocop-rspec (2.5.0)
|
||||
rubocop (~> 1.19)
|
||||
ruby-progressbar (1.11.0)
|
||||
ruby-saml (1.12.2)
|
||||
nokogiri (>= 1.10.5)
|
||||
|
@ -613,7 +612,7 @@ GEM
|
|||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.7)
|
||||
unicode-display_width (2.0.0)
|
||||
unicode-display_width (2.1.0)
|
||||
unicorn (6.0.0)
|
||||
kgio (~> 2.6)
|
||||
raindrops (~> 0.7)
|
||||
|
|
|
@ -17,7 +17,7 @@ RSpec.describe Issue3446Microsoft365Tenants, type: :db_migration do
|
|||
.to('app_tenant')
|
||||
end
|
||||
|
||||
it 'changes form fields count from 2 to 3 ' do
|
||||
it 'changes form fields count from 2 to 3' do
|
||||
expect { migrate }
|
||||
.to change { setting.reload.options['form'].count }
|
||||
.from(2)
|
||||
|
|
|
@ -120,7 +120,7 @@ RSpec.describe HasActiveJobLock, type: :job do
|
|||
end
|
||||
end
|
||||
|
||||
context "when ActiveRecord::SerializationFailure 'PG::TRSerializationFailure: ERROR: could not serialize access due to concurrent update' is raised" do
|
||||
context "when ActiveRecord::SerializationFailure 'PG::TRSerializationFailure: ERROR: could not serialize access due to concurrent update' is raised" do
|
||||
|
||||
it 'retries execution until succeed' do
|
||||
allow(ActiveRecord::Base.connection).to receive(:open_transactions).and_return(0)
|
||||
|
|
|
@ -1492,7 +1492,7 @@ RSpec.describe String do
|
|||
TEXT
|
||||
end
|
||||
|
||||
it 'places marker before quoted reply’s "Von:" header (as <p> with parent <div>)' do
|
||||
it 'places marker before quoted reply’s "Von:" header (as <p> with parent <div>)' do
|
||||
expect(<<~HTML.chomp.html2html_strict).to eq(<<~TEXT.chomp)
|
||||
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
|
||||
<p class="MsoNormal" style="margin-left:35.4pt"><b><span style="font-family:Calibri;color:black">Von:
|
||||
|
@ -1872,32 +1872,32 @@ RSpec.describe String do
|
|||
|
||||
describe '#utf8_encode' do
|
||||
context 'on valid, UTF-8-encoded strings' do
|
||||
let(:subject) { 'hello' }
|
||||
subject(:string) { 'hello' }
|
||||
|
||||
it 'returns an identical copy' do
|
||||
expect(subject.utf8_encode).to eq(subject)
|
||||
expect(subject.utf8_encode.encoding).to be(subject.encoding)
|
||||
expect(subject.utf8_encode).not_to be(subject)
|
||||
expect(string.utf8_encode).to eq(string)
|
||||
expect(string.utf8_encode.encoding).to be(string.encoding)
|
||||
expect(string.utf8_encode).not_to be(string)
|
||||
end
|
||||
|
||||
context 'which are incorrectly set to other, technically valid encodings' do
|
||||
let(:subject) { described_class.new('ö', encoding: 'tis-620') }
|
||||
subject(:string) { described_class.new('ö', encoding: 'tis-620') }
|
||||
|
||||
it 'sets input encoding to UTF-8 instead of attempting conversion' do
|
||||
expect(subject.utf8_encode).to eq(subject.dup.force_encoding('utf-8'))
|
||||
expect(string.utf8_encode).to eq(string.dup.force_encoding('utf-8'))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'on strings in other encodings' do
|
||||
let(:subject) { original_string.encode(input_encoding) }
|
||||
subject(:string) { original_string.encode(input_encoding) }
|
||||
|
||||
context 'with no from: option' do
|
||||
let(:original_string) { 'Tschüss!' }
|
||||
let(:input_encoding) { Encoding::ISO_8859_2 }
|
||||
|
||||
it 'detects the input encoding' do
|
||||
expect(subject.utf8_encode).to eq(original_string)
|
||||
expect(string.utf8_encode).to eq(original_string)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1906,11 +1906,11 @@ RSpec.describe String do
|
|||
let(:input_encoding) { Encoding::ISO_8859_2 }
|
||||
|
||||
it 'uses the specified input encoding' do
|
||||
expect(subject.utf8_encode(from: 'iso-8859-2')).to eq(original_string)
|
||||
expect(string.utf8_encode(from: 'iso-8859-2')).to eq(original_string)
|
||||
end
|
||||
|
||||
it 'uses any valid input encoding, even if not correct' do
|
||||
expect(subject.utf8_encode(from: 'gb18030')).to eq('Tsch黶s!')
|
||||
expect(string.utf8_encode(from: 'gb18030')).to eq('Tsch黶s!')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1919,21 +1919,21 @@ RSpec.describe String do
|
|||
let(:input_encoding) { Encoding::GB18030 }
|
||||
|
||||
it 'does not try it' do
|
||||
expect { subject.encode('utf-8', 'gb2312') }
|
||||
expect { string.encode('utf-8', 'gb2312') }
|
||||
.to raise_error(Encoding::InvalidByteSequenceError)
|
||||
|
||||
expect { subject.utf8_encode(from: 'gb2312') }
|
||||
expect { string.utf8_encode(from: 'gb2312') }
|
||||
.not_to raise_error
|
||||
end
|
||||
|
||||
it 'uses the detected input encoding instead' do
|
||||
expect(subject.utf8_encode(from: 'gb2312')).to eq(original_string)
|
||||
expect(string.utf8_encode(from: 'gb2312')).to eq(original_string)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'performance' do
|
||||
let(:subject) { original_string.encode(input_encoding) }
|
||||
subject(:string) { original_string.encode(input_encoding) }
|
||||
|
||||
context 'with utf8_encode in iso-8859-1' do
|
||||
let(:original_string) { 'äöü0' * 999_999 }
|
||||
|
@ -1941,7 +1941,7 @@ RSpec.describe String do
|
|||
|
||||
it 'detects the input encoding' do
|
||||
Timeout.timeout(1) do
|
||||
expect(subject.utf8_encode(from: 'iso-8859-1')).to eq(original_string)
|
||||
expect(string.utf8_encode(from: 'iso-8859-1')).to eq(original_string)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1952,7 +1952,7 @@ RSpec.describe String do
|
|||
|
||||
it 'detects the input encoding' do
|
||||
Timeout.timeout(1) do
|
||||
expect(subject.utf8_encode(from: 'utf-8')).to eq(original_string)
|
||||
expect(string.utf8_encode(from: 'utf-8')).to eq(original_string)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1963,7 +1963,7 @@ RSpec.describe String do
|
|||
|
||||
it 'detects the input encoding' do
|
||||
Timeout.timeout(18) do
|
||||
expect(subject.utf8_encode(from: 'utf-8')).to eq(original_string)
|
||||
expect(string.utf8_encode(from: 'utf-8')).to eq(original_string)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,8 @@ RSpec.describe Import::Exchange::Folder do
|
|||
# see https://github.com/zammad/zammad/issues/2152
|
||||
|
||||
describe '#display_path (#2152)', :use_vcr do
|
||||
let(:subject) { described_class.new(ews_connection) }
|
||||
subject(:folder) { described_class.new(ews_connection) }
|
||||
|
||||
let(:ews_connection) { Viewpoint::EWSClient.new(endpoint, user, pass) }
|
||||
let(:endpoint) { 'https://exchange.example.com/EWS/Exchange.asmx' }
|
||||
let(:user) { 'user@example.com' }
|
||||
|
@ -18,24 +19,24 @@ RSpec.describe Import::Exchange::Folder do
|
|||
context 'when server returns valid UTF-8' do
|
||||
context 'and target folder is in root directory' do
|
||||
it 'returns the display name of the folder' do
|
||||
expect(subject.display_path(child_of_root))
|
||||
expect(folder.display_path(child_of_root))
|
||||
.to eq('Top of Information Store')
|
||||
end
|
||||
end
|
||||
|
||||
context 'and target folder is in subfolder of root' do
|
||||
it 'returns the full path from root to target' do
|
||||
expect(subject.display_path(grandchild_of_root))
|
||||
expect(folder.display_path(grandchild_of_root))
|
||||
.to eq('Top of Information Store -> Inbox')
|
||||
end
|
||||
end
|
||||
|
||||
context 'and walking up directory tree raises EwsError' do
|
||||
it 'returns the partial path from error to target folder' do
|
||||
allow(subject)
|
||||
allow(folder)
|
||||
.to receive(:id_folder_map).with(any_args).and_raise(Viewpoint::EWS::EwsError)
|
||||
|
||||
expect(subject.display_path(grandchild_of_root))
|
||||
expect(folder.display_path(grandchild_of_root))
|
||||
.to eq('Inbox')
|
||||
end
|
||||
end
|
||||
|
@ -47,7 +48,7 @@ RSpec.describe Import::Exchange::Folder do
|
|||
allow(child_of_root)
|
||||
.to receive(:display_name).and_return('你好'.b)
|
||||
|
||||
expect { subject.display_path(child_of_root).to_json }.not_to raise_error
|
||||
expect { folder.display_path(child_of_root).to_json }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -56,7 +57,7 @@ RSpec.describe Import::Exchange::Folder do
|
|||
allow(grandchild_of_root)
|
||||
.to receive(:display_name).and_return('你好'.b)
|
||||
|
||||
expect { subject.display_path(grandchild_of_root).to_json }.not_to raise_error
|
||||
expect { folder.display_path(grandchild_of_root).to_json }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -64,10 +65,10 @@ RSpec.describe Import::Exchange::Folder do
|
|||
it 'returns the partial path from error to target folder in valid UTF-8' do
|
||||
allow(grandchild_of_root)
|
||||
.to receive(:display_name).and_return('你好'.b)
|
||||
allow(subject)
|
||||
allow(folder)
|
||||
.to receive(:id_folder_map).with(any_args).and_raise(Viewpoint::EWS::EwsError)
|
||||
|
||||
expect { subject.display_path(grandchild_of_root).to_json }.not_to raise_error
|
||||
expect { folder.display_path(grandchild_of_root).to_json }.not_to raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -218,8 +218,9 @@ RSpec.describe Ldap::User do
|
|||
end
|
||||
|
||||
describe 'attributes' do
|
||||
let(:subject) { described_class.new(config, ldap: ldap) }
|
||||
let(:ldap) { Ldap.new(config) }
|
||||
subject(:user) { described_class.new(config, ldap: ldap) }
|
||||
|
||||
let(:ldap) { Ldap.new(config) }
|
||||
let(:config) do
|
||||
{ 'host_url' => 'ldap://localhost',
|
||||
'options' => { 'dc=example,dc=org' => 'dc=example,dc=org' },
|
||||
|
@ -240,7 +241,7 @@ RSpec.describe Ldap::User do
|
|||
# ActiveRecord::Store would convert them to binary (ASCII-8BIT) strings,
|
||||
# which would then break #to_json with an Encoding::UndefinedConversion error.
|
||||
it 'skips binary attributes (#2140)' do
|
||||
Setting.set('ldap_config', subject.attributes)
|
||||
Setting.set('ldap_config', user.attributes)
|
||||
|
||||
expect { Setting.get('ldap_config').to_json }
|
||||
.not_to raise_error
|
||||
|
|
|
@ -90,7 +90,7 @@ RSpec.describe ::Sequencer::Sequence::Import::Freshdesk::Agent, sequencer: :sequ
|
|||
expect(User.last.roles.sort.map(&:name)).to eq ['Agent']
|
||||
end
|
||||
|
||||
it 'sets user groups correctly ' do
|
||||
it 'sets user groups correctly' do
|
||||
process(process_payload)
|
||||
expect(User.last.groups_access('full').sort).to eq groups
|
||||
end
|
||||
|
|
|
@ -80,7 +80,7 @@ RSpec.describe ::Sequencer::Sequence::Import::Freshdesk::Conversation, sequencer
|
|||
expect { process(process_payload) }.to change(Ticket::Article, :count).by(1)
|
||||
end
|
||||
|
||||
it 'correct attributes for added article ' do
|
||||
it 'correct attributes for added article' do
|
||||
process(process_payload)
|
||||
expect(Ticket::Article.last).to have_attributes(
|
||||
to: 'info@zammad.org',
|
||||
|
|
|
@ -174,7 +174,7 @@ RSpec.describe ::Sequencer::Sequence::Import::Freshdesk::Ticket, sequencer: :seq
|
|||
expect { process(process_payload) }.to change(Ticket::Article, :count).by(1)
|
||||
end
|
||||
|
||||
it 'correct attributes for added article ' do
|
||||
it 'correct attributes for added article' do
|
||||
process(process_payload)
|
||||
expect(Ticket::Article.last).to have_attributes(
|
||||
to: 'info@zammad.org',
|
||||
|
|
|
@ -55,7 +55,7 @@ RSpec.describe ::Sequencer::Sequence::Import::Freshdesk::TimeEntry, sequencer: :
|
|||
expect { process(process_payload) }.to change(Ticket::TimeAccounting, :count).by(1)
|
||||
end
|
||||
|
||||
it 'correct attributes for added time entry ' do
|
||||
it 'correct attributes for added time entry' do
|
||||
process(process_payload)
|
||||
expect(Ticket::TimeAccounting.last).to have_attributes(imported_time_entry)
|
||||
end
|
||||
|
|
|
@ -139,7 +139,7 @@ RSpec.describe ::Sequencer::Sequence::Import::Zendesk::User, sequencer: :sequenc
|
|||
expect(User.last.roles.sort.map(&:name)).to eq ['Agent']
|
||||
end
|
||||
|
||||
it 'sets user groups correctly ' do
|
||||
it 'sets user groups correctly' do
|
||||
process(process_payload)
|
||||
expect(User.last.groups_access('full').sort).to eq groups
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Sequencer::Unit::Import::Ldap::User::Attributes::RoleIds::Unassigned, sequencer: :unit do
|
||||
let(:subject) { process(parameters) }
|
||||
subject(:unit) { process(parameters) }
|
||||
|
||||
let(:parameters) do
|
||||
{ resource: resource,
|
||||
|
@ -44,7 +44,7 @@ RSpec.describe Sequencer::Unit::Import::Ldap::User::Attributes::RoleIds::Unassig
|
|||
before { instance.update(active: true) }
|
||||
|
||||
it 'deactivates user (with action: :deactivated)' do
|
||||
expect(subject).to include(action: :deactivated)
|
||||
expect(unit).to include(action: :deactivated)
|
||||
expect(instance.reload.active).to be(false)
|
||||
end
|
||||
end
|
||||
|
@ -53,7 +53,7 @@ RSpec.describe Sequencer::Unit::Import::Ldap::User::Attributes::RoleIds::Unassig
|
|||
before { instance.update(active: false) }
|
||||
|
||||
it 'skips user (with action: :skipped)' do
|
||||
expect(subject).to include(action: :skipped)
|
||||
expect(unit).to include(action: :skipped)
|
||||
expect(instance.reload.active).to be(false)
|
||||
end
|
||||
end
|
||||
|
@ -63,7 +63,7 @@ RSpec.describe Sequencer::Unit::Import::Ldap::User::Attributes::RoleIds::Unassig
|
|||
let(:instance) { nil }
|
||||
|
||||
it 'skips user (with action: :skipped)' do
|
||||
expect(subject).to include(action: :skipped)
|
||||
expect(unit).to include(action: :skipped)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -74,7 +74,7 @@ RSpec.describe Sequencer::Unit::Import::Ldap::User::Attributes::RoleIds::Unassig
|
|||
before { parameters[:dn_roles].clear }
|
||||
|
||||
it 'skips user (with NO action)' do
|
||||
expect(subject).to include(action: nil)
|
||||
expect(unit).to include(action: nil)
|
||||
expect(instance).not_to have_received(:update)
|
||||
end
|
||||
end
|
||||
|
@ -83,7 +83,7 @@ RSpec.describe Sequencer::Unit::Import::Ldap::User::Attributes::RoleIds::Unassig
|
|||
before { parameters[:mapped].merge!(role_ids: [2]) }
|
||||
|
||||
it 'skips user (with NO action)' do
|
||||
expect(subject).to include(action: nil)
|
||||
expect(unit).to include(action: nil)
|
||||
expect(instance).not_to have_received(:update)
|
||||
end
|
||||
end
|
||||
|
@ -92,7 +92,7 @@ RSpec.describe Sequencer::Unit::Import::Ldap::User::Attributes::RoleIds::Unassig
|
|||
before { parameters[:ldap_config].merge!(unassigned_users: 'sigup_roles') }
|
||||
|
||||
it 'skips user (with NO action)' do
|
||||
expect(subject).to include(action: nil)
|
||||
expect(unit).to include(action: nil)
|
||||
expect(instance).not_to have_received(:update)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,8 @@ require 'rails_helper'
|
|||
|
||||
RSpec.describe Sessions::Backend::ActivityStream do
|
||||
context 'when async processes affect associated objects / DB records (#2066)' do
|
||||
let(:subject) { described_class.new(user, {}) }
|
||||
subject(:activity_stream) { described_class.new(user, {}) }
|
||||
|
||||
let(:user) { create(:agent, groups: [group]) }
|
||||
let(:group) { Group.find_by(name: 'Users') }
|
||||
let(:associated_tickets) { create_list(:ticket, ticket_count, group: group) }
|
||||
|
@ -20,7 +21,7 @@ RSpec.describe Sessions::Backend::ActivityStream do
|
|||
|
||||
it 'manages race condition' do
|
||||
thread = Thread.new { associated_tickets.each(&:destroy) }
|
||||
expect { subject.load }.not_to raise_error
|
||||
expect { activity_stream.load }.not_to raise_error
|
||||
thread.join
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ require 'rails_helper'
|
|||
|
||||
RSpec.describe UploadCache do
|
||||
|
||||
let(:subject) { described_class.new(1337) }
|
||||
subject(:upload_cache) { described_class.new(1337) }
|
||||
|
||||
# required for adding items to the Store
|
||||
before { UserInfo.current_user_id = 1 }
|
||||
|
@ -20,7 +20,7 @@ RSpec.describe UploadCache do
|
|||
|
||||
it 'adds a Store item' do
|
||||
expect do
|
||||
subject.add(
|
||||
upload_cache.add(
|
||||
data: 'content_file3_normally_should_be_an_image',
|
||||
filename: 'some_file3.jpg',
|
||||
preferences: {
|
||||
|
@ -36,7 +36,7 @@ RSpec.describe UploadCache do
|
|||
describe '#attachments' do
|
||||
|
||||
before do
|
||||
subject.add(
|
||||
upload_cache.add(
|
||||
data: 'hello world',
|
||||
filename: 'some.txt',
|
||||
preferences: {
|
||||
|
@ -46,7 +46,7 @@ RSpec.describe UploadCache do
|
|||
end
|
||||
|
||||
it 'returns all Store items' do
|
||||
attachments = subject.attachments
|
||||
attachments = upload_cache.attachments
|
||||
|
||||
expect(attachments.count).to be(1)
|
||||
expect(attachments).to include(Store.last)
|
||||
|
@ -56,7 +56,7 @@ RSpec.describe UploadCache do
|
|||
describe '#destroy' do
|
||||
|
||||
before do
|
||||
subject.add(
|
||||
upload_cache.add(
|
||||
data: 'hello world',
|
||||
filename: 'some.txt',
|
||||
preferences: {
|
||||
|
@ -64,7 +64,7 @@ RSpec.describe UploadCache do
|
|||
},
|
||||
)
|
||||
|
||||
subject.add(
|
||||
upload_cache.add(
|
||||
data: 'hello other world',
|
||||
filename: 'another_some.txt',
|
||||
preferences: {
|
||||
|
@ -74,14 +74,14 @@ RSpec.describe UploadCache do
|
|||
end
|
||||
|
||||
it 'removes all added Store items' do
|
||||
expect { subject.destroy }.to change(Store, :count).by(-2)
|
||||
expect { upload_cache.destroy }.to change(Store, :count).by(-2)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#remove_item' do
|
||||
|
||||
before do
|
||||
subject.add(
|
||||
upload_cache.add(
|
||||
data: 'hello world',
|
||||
filename: 'some.txt',
|
||||
preferences: {
|
||||
|
@ -91,7 +91,7 @@ RSpec.describe UploadCache do
|
|||
end
|
||||
|
||||
it 'removes the Store item matching the given ID' do
|
||||
expect { subject.remove_item(Store.last.id) }.to change(Store, :count).by(-1)
|
||||
expect { upload_cache.remove_item(Store.last.id) }.to change(Store, :count).by(-1)
|
||||
end
|
||||
|
||||
it 'prevents removage of non UploadCache Store items' do
|
||||
|
@ -106,11 +106,11 @@ RSpec.describe UploadCache do
|
|||
},
|
||||
)
|
||||
|
||||
expect { subject.remove_item(item.id) }.to raise_error(Exceptions::UnprocessableEntity)
|
||||
expect { upload_cache.remove_item(item.id) }.to raise_error(Exceptions::UnprocessableEntity)
|
||||
end
|
||||
|
||||
it 'fails for non existing UploadCache Store items' do
|
||||
expect { subject.remove_item(1337) }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
expect { upload_cache.remove_item(1337) }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ RSpec.describe Channel::Filter::InternalArticleCheck do
|
|||
let(:from) { "From: <#{vendor_email}>" }
|
||||
let(:message_id) { 'some_message_id_999@example.com' }
|
||||
let(:in_reply_to) { message_id }
|
||||
let(:subject) { "Subject: #{ticket.subject_build('some subject')}" }
|
||||
let(:article_subject) { "Subject: #{ticket.subject_build('some subject')}" }
|
||||
let(:ticket_article) { build(:ticket_article, ticket: ticket, to: article_to, internal: false, message_id: message_id) }
|
||||
let(:inbound_email) { create(:ticket_article, :inbound_email, ticket: ticket) }
|
||||
let(:outbound_email) { create(:ticket_article, :outbound_email, ticket: ticket) }
|
||||
|
@ -23,7 +23,7 @@ RSpec.describe Channel::Filter::InternalArticleCheck do
|
|||
let(:email_parse_mail_answer) do
|
||||
channel_as_model = Channel.new(options: {})
|
||||
|
||||
email_raw_string.sub!(%r{^Subject: .+?$}, subject)
|
||||
email_raw_string.sub!(%r{^Subject: .+?$}, article_subject)
|
||||
email_raw_string.sub!('From: <John.Smith@example.com>', from)
|
||||
email_raw_string.sub!('Message-Id: <053EA3703574649ABDAF24D43A05604F327A130@MEMASFRK004.example.com>', "Message-Id: <053EA3703574649ABDAF24D43A05604F327A130@MEMASFRK004.example.com>\nIn-Reply-To: #{in_reply_to}")
|
||||
Channel::EmailParser.new.process(channel_as_model, email_raw_string)
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe HttpLog do
|
||||
let(:subject) { build(:http_log) }
|
||||
subject(:http_log) { build(:http_log) }
|
||||
|
||||
describe 'callbacks' do
|
||||
# See https://github.com/zammad/zammad/issues/2100
|
||||
it 'converts request/response message data to UTF-8 before saving' do
|
||||
subject.request[:content] = 'foo'.force_encoding('ascii-8bit')
|
||||
subject.response[:content] = 'bar'.force_encoding('ascii-8bit')
|
||||
http_log.request[:content] = 'foo'.force_encoding('ascii-8bit')
|
||||
http_log.response[:content] = 'bar'.force_encoding('ascii-8bit')
|
||||
|
||||
expect { subject.save }
|
||||
.to change { subject.request[:content].encoding.name }.from('ASCII-8BIT').to('UTF-8')
|
||||
.and change { subject.response[:content].encoding.name }.from('ASCII-8BIT').to('UTF-8')
|
||||
expect { http_log.save }
|
||||
.to change { http_log.request[:content].encoding.name }.from('ASCII-8BIT').to('UTF-8')
|
||||
.and change { http_log.response[:content].encoding.name }.from('ASCII-8BIT').to('UTF-8')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,44 +6,44 @@ RSpec.describe ObjectManager::Attribute, type: :model do
|
|||
|
||||
describe 'callbacks' do
|
||||
context 'for setting default values on local data options' do
|
||||
let(:subject) { described_class.new }
|
||||
subject(:attr) { described_class.new }
|
||||
|
||||
context ':null' do
|
||||
it 'sets nil values to true' do
|
||||
expect { subject.validate }
|
||||
.to change { subject.data_option[:null] }.to(true)
|
||||
expect { attr.validate }
|
||||
.to change { attr.data_option[:null] }.to(true)
|
||||
end
|
||||
|
||||
it 'does not overwrite false values' do
|
||||
subject.data_option[:null] = false
|
||||
attr.data_option[:null] = false
|
||||
|
||||
expect { subject.validate }
|
||||
.not_to change { subject.data_option[:null] }
|
||||
expect { attr.validate }
|
||||
.not_to change { attr.data_option[:null] }
|
||||
end
|
||||
end
|
||||
|
||||
context ':maxlength' do
|
||||
context 'for data_type: select / tree_select / checkbox' do
|
||||
let(:subject) { described_class.new(data_type: 'select') }
|
||||
subject(:attr) { described_class.new(data_type: 'select') }
|
||||
|
||||
it 'sets nil values to 255' do
|
||||
expect { subject.validate }
|
||||
.to change { subject.data_option[:maxlength] }.to(255)
|
||||
expect { attr.validate }
|
||||
.to change { attr.data_option[:maxlength] }.to(255)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context ':nulloption' do
|
||||
context 'for data_type: select / tree_select / checkbox' do
|
||||
let(:subject) { described_class.new(data_type: 'select') }
|
||||
subject(:attr) { described_class.new(data_type: 'select') }
|
||||
|
||||
it 'sets nil values to true' do
|
||||
expect { subject.validate }
|
||||
.to change { subject.data_option[:nulloption] }.to(true)
|
||||
expect { attr.validate }
|
||||
.to change { attr.data_option[:nulloption] }.to(true)
|
||||
end
|
||||
|
||||
it 'does not overwrite false values' do
|
||||
subject.data_option[:nulloption] = false
|
||||
attr.data_option[:nulloption] = false
|
||||
|
||||
expect { subject.validate }
|
||||
.not_to change { subject.data_option[:nulloption] }
|
||||
|
|
|
@ -754,7 +754,7 @@ RSpec.describe Ticket, type: :model do
|
|||
end
|
||||
end
|
||||
|
||||
context 'dispatching email with include attachment not present' do
|
||||
context 'dispatching email with include attachment not present' do
|
||||
let(:notification_type) { :email }
|
||||
let(:additional_options) do
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ RSpec.describe Tag, type: :request do
|
|||
let(:foobar_tag) { tags.first }
|
||||
|
||||
shared_examples 'foobar tag found using' do |search_term:|
|
||||
it "found 1 tag using search term '#{search_term}'" do
|
||||
it "found 1 tag using search term '#{search_term}'" do
|
||||
get '/api/v1/tag_search', params: { term: search_term }
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json_response).to contain_exactly('id' => foobar_tag.id, 'value' => foobar_tag.name)
|
||||
|
@ -33,7 +33,7 @@ RSpec.describe Tag, type: :request do
|
|||
end
|
||||
|
||||
shared_examples 'no tag found using' do |search_term:|
|
||||
it "found 0 tags using search term '#{search_term}'" do
|
||||
it "found 0 tags using search term '#{search_term}'" do
|
||||
get '/api/v1/tag_search', params: { term: search_term }
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json_response).to contain_exactly
|
||||
|
|
|
@ -2145,7 +2145,7 @@ RSpec.describe 'Ticket', type: :request do
|
|||
expect(json_response['tickets']).to eq([ticket2.id, ticket1.id])
|
||||
end
|
||||
|
||||
it 'does ticket history ' do
|
||||
it 'does ticket history' do
|
||||
ticket1 = create(
|
||||
:ticket,
|
||||
title: 'some title',
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Caller log', type: %i[system request] do # rubocop:disable RSpec/DescribeClass
|
||||
RSpec.describe 'Caller log', type: %i[system request] do
|
||||
let(:admin) do
|
||||
create(:admin, groups: Group.all)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue