chore: rubocop

chore: fix api test conventions

chore: rubocop -A spec/

chore: more rubocop -A

fix failing test

rubocop fixes

removes helper methods that are in my opinion dead code

more rubocop fixes

rubocop -a --auto-gen-config
This commit is contained in:
Philipp Rothmann 2023-05-12 13:01:12 +02:00 committed by Philipp Rothmann
parent f6fb804bbe
commit fb2b4d8a8a
331 changed files with 4263 additions and 4507 deletions

View file

@ -6,55 +6,6 @@ describe FoodsoftMailReceiver do
@server.start
end
it 'does not accept empty addresses' do
begin
FoodsoftMailReceiver.received('', 'body')
rescue => error
expect(error.to_s).to include 'missing'
end
end
it 'does not accept invalid addresses' do
begin
FoodsoftMailReceiver.received('invalid', 'body')
rescue => error
expect(error.to_s).to include 'has an invalid format'
end
end
it 'does not accept invalid scope in address' do
begin
FoodsoftMailReceiver.received('invalid.invalid', 'body')
rescue => error
expect(error.to_s).to include 'could not be found'
end
end
it 'does not accept address without handler' do
begin
address = "#{FoodsoftConfig[:default_scope]}.invalid"
FoodsoftMailReceiver.received(address, 'body')
rescue => error
expect(error.to_s).to include 'invalid format for recipient'
end
end
it 'does not accept invalid addresses via SMTP' do
expect {
Net::SMTP.start(@server.hosts.first, @server.ports.first) do |smtp|
smtp.send_message 'body', 'from@example.com', 'invalid'
end
}.to raise_error(Net::SMTPFatalError)
end
it 'does not accept invalid addresses via SMTP' do
expect {
Net::SMTP.start(@server.hosts.first, @server.ports.first) do |smtp|
smtp.send_message 'body', 'from@example.com', 'invalid'
end
}.to raise_error(Net::SMTPFatalError)
end
# TODO: Reanable this test.
# It raised "Mysql2::Error: Lock wait timeout exceeded" at time of writing.
# it 'accepts bounce mails via SMTP' do
@ -74,4 +25,45 @@ describe FoodsoftMailReceiver do
after :all do
@server.shutdown
end
it 'does not accept empty addresses' do
FoodsoftMailReceiver.received('', 'body')
rescue StandardError => e
expect(e.to_s).to include 'missing'
end
it 'does not accept invalid addresses' do
FoodsoftMailReceiver.received('invalid', 'body')
rescue StandardError => e
expect(e.to_s).to include 'has an invalid format'
end
it 'does not accept invalid scope in address' do
FoodsoftMailReceiver.received('invalid.invalid', 'body')
rescue StandardError => e
expect(e.to_s).to include 'could not be found'
end
it 'does not accept address without handler' do
address = "#{FoodsoftConfig[:default_scope]}.invalid"
FoodsoftMailReceiver.received(address, 'body')
rescue StandardError => e
expect(e.to_s).to include 'invalid format for recipient'
end
it 'does not accept invalid addresses via SMTP' do
expect do
Net::SMTP.start(@server.hosts.first, @server.ports.first) do |smtp|
smtp.send_message 'body', 'from@example.com', 'invalid'
end
end.to raise_error(Net::SMTPFatalError)
end
it 'does not accept invalid addresses via SMTP' do
expect do
Net::SMTP.start(@server.hosts.first, @server.ports.first) do |smtp|
smtp.send_message 'body', 'from@example.com', 'invalid'
end
end.to raise_error(Net::SMTPFatalError)
end
end