مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2026-01-18 13:59:47 +00:00
style(rubocop): fix all safe auto correctable offenses
هذا الالتزام موجود في:
@@ -1,7 +1,6 @@
|
||||
require 'rails_helper'
|
||||
require "rails_helper"
|
||||
|
||||
describe Organization do
|
||||
|
||||
context "model" do
|
||||
subject(:organization) { create(:organization) }
|
||||
|
||||
@@ -10,5 +9,4 @@ describe Organization do
|
||||
expect(organization.uuid.length).to eq 36
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
require 'rails_helper'
|
||||
require "rails_helper"
|
||||
|
||||
describe OutgoingMessagePrototype do
|
||||
|
||||
it "should create a new message" do
|
||||
with_global_server do |server|
|
||||
domain = create(:domain, :owner => server)
|
||||
prototype = OutgoingMessagePrototype.new(server, '127.0.0.1', 'TestSuite', {
|
||||
:from => "test@#{domain.name}",
|
||||
:to => "test@example.com",
|
||||
:subject => "Test Message",
|
||||
:plain_body => "A plain body!"
|
||||
domain = create(:domain, owner: server)
|
||||
prototype = OutgoingMessagePrototype.new(server, "127.0.0.1", "TestSuite", {
|
||||
from: "test@#{domain.name}",
|
||||
to: "test@example.com",
|
||||
subject: "Test Message",
|
||||
plain_body: "A plain body!"
|
||||
})
|
||||
|
||||
expect(prototype.valid?).to be true
|
||||
message = prototype.create_message('test@example.com')
|
||||
message = prototype.create_message("test@example.com")
|
||||
expect(message).to be_a Hash
|
||||
expect(message[:id]).to be_a Integer
|
||||
expect(message[:token]).to be_a String
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require 'rails_helper'
|
||||
require "rails_helper"
|
||||
|
||||
describe Server do
|
||||
|
||||
context "model" do
|
||||
subject(:server) { create(:server) }
|
||||
|
||||
@@ -10,5 +9,4 @@ describe Server do
|
||||
expect(server.uuid.length).to eq 36
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require 'rails_helper'
|
||||
require "rails_helper"
|
||||
|
||||
describe User do
|
||||
|
||||
context "model" do
|
||||
subject(:user) { create(:user) }
|
||||
|
||||
@@ -13,24 +12,23 @@ describe User do
|
||||
|
||||
context ".authenticate" do
|
||||
it "should not authenticate users with invalid emails" do
|
||||
expect { User.authenticate('nothing@nothing.com', 'hello') }.to raise_error(Postal::Errors::AuthenticationError) do |e|
|
||||
expect(e.error).to eq 'InvalidEmailAddress'
|
||||
expect { User.authenticate("nothing@nothing.com", "hello") }.to raise_error(Postal::Errors::AuthenticationError) do |e|
|
||||
expect(e.error).to eq "InvalidEmailAddress"
|
||||
end
|
||||
end
|
||||
|
||||
it "should not authenticate users with invalid passwords" do
|
||||
user = create(:user)
|
||||
expect { User.authenticate(user.email_address, 'hello') }.to raise_error(Postal::Errors::AuthenticationError) do |e|
|
||||
expect(e.error).to eq 'InvalidPassword'
|
||||
expect { User.authenticate(user.email_address, "hello") }.to raise_error(Postal::Errors::AuthenticationError) do |e|
|
||||
expect(e.error).to eq "InvalidPassword"
|
||||
end
|
||||
end
|
||||
|
||||
it "should authenticate valid users" do
|
||||
user = create(:user)
|
||||
auth_user = nil
|
||||
expect { auth_user = User.authenticate(user.email_address, 'passw0rd') }.to_not raise_error
|
||||
expect { auth_user = User.authenticate(user.email_address, "passw0rd") }.to_not raise_error
|
||||
expect(auth_user).to eq user
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم