diff --git a/Gemfile.lock b/Gemfile.lock index 8cdf115d3..24521dd3d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/spec/db/migrate/issue_3446_microsoft_365_tenants_spec.rb b/spec/db/migrate/issue_3446_microsoft_365_tenants_spec.rb index e433d8aa7..d84ec4f0f 100644 --- a/spec/db/migrate/issue_3446_microsoft_365_tenants_spec.rb +++ b/spec/db/migrate/issue_3446_microsoft_365_tenants_spec.rb @@ -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) diff --git a/spec/jobs/concerns/has_active_job_lock_spec.rb b/spec/jobs/concerns/has_active_job_lock_spec.rb index ac57fec0e..0b9eaa35e 100644 --- a/spec/jobs/concerns/has_active_job_lock_spec.rb +++ b/spec/jobs/concerns/has_active_job_lock_spec.rb @@ -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) diff --git a/spec/lib/core_ext/string_spec.rb b/spec/lib/core_ext/string_spec.rb index 354ff103e..0367f7ea3 100644 --- a/spec/lib/core_ext/string_spec.rb +++ b/spec/lib/core_ext/string_spec.rb @@ -1492,7 +1492,7 @@ RSpec.describe String do TEXT end - it 'places marker before quoted reply’s "Von:" header (as

with parent

)' do + it 'places marker before quoted reply’s "Von:" header (as

with parent

)' do expect(<<~HTML.chomp.html2html_strict).to eq(<<~TEXT.chomp)

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 diff --git a/spec/lib/import/exchange/folder_spec.rb b/spec/lib/import/exchange/folder_spec.rb index baef7b411..218ec172b 100644 --- a/spec/lib/import/exchange/folder_spec.rb +++ b/spec/lib/import/exchange/folder_spec.rb @@ -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 diff --git a/spec/lib/ldap/user_spec.rb b/spec/lib/ldap/user_spec.rb index 06d0d895e..38bfe200b 100644 --- a/spec/lib/ldap/user_spec.rb +++ b/spec/lib/ldap/user_spec.rb @@ -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 diff --git a/spec/lib/sequencer/sequence/import/freshdesk/agent_spec.rb b/spec/lib/sequencer/sequence/import/freshdesk/agent_spec.rb index e3ee76bf5..9aa1c2290 100644 --- a/spec/lib/sequencer/sequence/import/freshdesk/agent_spec.rb +++ b/spec/lib/sequencer/sequence/import/freshdesk/agent_spec.rb @@ -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 diff --git a/spec/lib/sequencer/sequence/import/freshdesk/conversation_spec.rb b/spec/lib/sequencer/sequence/import/freshdesk/conversation_spec.rb index 4307a2a36..61f4927a3 100644 --- a/spec/lib/sequencer/sequence/import/freshdesk/conversation_spec.rb +++ b/spec/lib/sequencer/sequence/import/freshdesk/conversation_spec.rb @@ -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', diff --git a/spec/lib/sequencer/sequence/import/freshdesk/ticket_spec.rb b/spec/lib/sequencer/sequence/import/freshdesk/ticket_spec.rb index fbad46203..f3206605e 100644 --- a/spec/lib/sequencer/sequence/import/freshdesk/ticket_spec.rb +++ b/spec/lib/sequencer/sequence/import/freshdesk/ticket_spec.rb @@ -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', diff --git a/spec/lib/sequencer/sequence/import/freshdesk/time_entry_spec.rb b/spec/lib/sequencer/sequence/import/freshdesk/time_entry_spec.rb index 3557825d2..81a8f9ce4 100644 --- a/spec/lib/sequencer/sequence/import/freshdesk/time_entry_spec.rb +++ b/spec/lib/sequencer/sequence/import/freshdesk/time_entry_spec.rb @@ -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 diff --git a/spec/lib/sequencer/sequence/import/zendesk/user_spec.rb b/spec/lib/sequencer/sequence/import/zendesk/user_spec.rb index 693678f68..72314dbaf 100644 --- a/spec/lib/sequencer/sequence/import/zendesk/user_spec.rb +++ b/spec/lib/sequencer/sequence/import/zendesk/user_spec.rb @@ -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 diff --git a/spec/lib/sequencer/unit/import/ldap/user/attributes/role_ids/unassigned_spec.rb b/spec/lib/sequencer/unit/import/ldap/user/attributes/role_ids/unassigned_spec.rb index 1bcbe918c..3f327d8f7 100644 --- a/spec/lib/sequencer/unit/import/ldap/user/attributes/role_ids/unassigned_spec.rb +++ b/spec/lib/sequencer/unit/import/ldap/user/attributes/role_ids/unassigned_spec.rb @@ -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 diff --git a/spec/lib/sessions/backend/activity_stream_spec.rb b/spec/lib/sessions/backend/activity_stream_spec.rb index 783a417ec..a4de83287 100644 --- a/spec/lib/sessions/backend/activity_stream_spec.rb +++ b/spec/lib/sessions/backend/activity_stream_spec.rb @@ -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 diff --git a/spec/lib/upload_cache_spec.rb b/spec/lib/upload_cache_spec.rb index 0d5744ca2..e19e82af6 100644 --- a/spec/lib/upload_cache_spec.rb +++ b/spec/lib/upload_cache_spec.rb @@ -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 diff --git a/spec/models/channel/filter/internal_article_check_spec.rb b/spec/models/channel/filter/internal_article_check_spec.rb index 02e3ea382..59194ea4e 100644 --- a/spec/models/channel/filter/internal_article_check_spec.rb +++ b/spec/models/channel/filter/internal_article_check_spec.rb @@ -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: ', 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) diff --git a/spec/models/http_log_spec.rb b/spec/models/http_log_spec.rb index 25b6fe97a..d24c50f0b 100644 --- a/spec/models/http_log_spec.rb +++ b/spec/models/http_log_spec.rb @@ -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 diff --git a/spec/models/object_manager/attribute_spec.rb b/spec/models/object_manager/attribute_spec.rb index aa75ed86d..4e71f5b58 100644 --- a/spec/models/object_manager/attribute_spec.rb +++ b/spec/models/object_manager/attribute_spec.rb @@ -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] } diff --git a/spec/models/ticket_spec.rb b/spec/models/ticket_spec.rb index 1725d4223..748e18849 100644 --- a/spec/models/ticket_spec.rb +++ b/spec/models/ticket_spec.rb @@ -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 { diff --git a/spec/requests/tag_spec.rb b/spec/requests/tag_spec.rb index fbef423f6..138fd9f01 100644 --- a/spec/requests/tag_spec.rb +++ b/spec/requests/tag_spec.rb @@ -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 diff --git a/spec/requests/ticket_spec.rb b/spec/requests/ticket_spec.rb index 732d8cff6..bf4d3754b 100644 --- a/spec/requests/ticket_spec.rb +++ b/spec/requests/ticket_spec.rb @@ -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', diff --git a/spec/system/cti_spec.rb b/spec/system/cti_spec.rb index 7750fef13..c28f751de 100644 --- a/spec/system/cti_spec.rb +++ b/spec/system/cti_spec.rb @@ -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