mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Upgrading Discourse to Zeitwerk (#8098)
Zeitwerk simplifies working with dependencies in dev and makes it easier reloading class chains. We no longer need to use Rails "require_dependency" anywhere and instead can just use standard Ruby patterns to require files. This is a far reaching change and we expect some followups here.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require_dependency "common_passwords/common_passwords"
|
||||
|
||||
describe PasswordValidator do
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require_dependency 'validators/post_validator'
|
||||
|
||||
describe Validators::PostValidator do
|
||||
describe PostValidator do
|
||||
fab!(:topic) { Fabricate(:topic) }
|
||||
let(:post) { build(:post, topic: topic) }
|
||||
let(:validator) { Validators::PostValidator.new({}) }
|
||||
let(:validator) { PostValidator.new({}) }
|
||||
|
||||
context "#post_body_validator" do
|
||||
it 'should not allow a post with an empty raw' do
|
||||
@@ -16,7 +15,7 @@ describe Validators::PostValidator do
|
||||
end
|
||||
|
||||
context "when empty raw can bypass validation" do
|
||||
let(:validator) { Validators::PostValidator.new(skip_post_body: true) }
|
||||
let(:validator) { PostValidator.new(skip_post_body: true) }
|
||||
|
||||
it "should be allowed for empty raw based on site setting" do
|
||||
post.raw = ""
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require_dependency 'validators/upload_validator'
|
||||
|
||||
describe Validators::UploadValidator do
|
||||
describe UploadValidator do
|
||||
subject(:validator) { described_class.new }
|
||||
|
||||
describe 'validate' do
|
||||
|
||||
Reference in New Issue
Block a user