Merge pull request #4792 from consul/fix_skip_validation_test
Avoid model inheritance in skip validation test
This commit is contained in:
@@ -49,19 +49,21 @@ describe SkipValidation do
|
|||||||
|
|
||||||
describe ".skip_translation_validation" do
|
describe ".skip_translation_validation" do
|
||||||
before do
|
before do
|
||||||
dummy_banner = Class.new(Banner) do
|
dummy_banner = Class.new(ApplicationRecord) do
|
||||||
def self.translation_class
|
def self.name
|
||||||
@translation_class ||= Class.new(Banner::Translation) { clear_validators! }
|
"DummyBanner"
|
||||||
end
|
end
|
||||||
reflect_on_association(:translations).options[:class_name] = "DummyBanner::Translation"
|
self.table_name = "banners"
|
||||||
|
|
||||||
|
translates :title, touch: true
|
||||||
|
translates :description, touch: true
|
||||||
|
include Globalizable
|
||||||
|
|
||||||
clear_validators!
|
|
||||||
validates_translation :title, presence: true
|
validates_translation :title, presence: true
|
||||||
validates_translation :description, presence: true
|
validates_translation :description, presence: true
|
||||||
end
|
end
|
||||||
|
|
||||||
stub_const("DummyBanner", dummy_banner)
|
stub_const("DummyBanner", dummy_banner)
|
||||||
stub_const("DummyBanner::Translation", dummy_banner.translation_class)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "removes the validation from the translatable attribute" do
|
it "removes the validation from the translatable attribute" do
|
||||||
|
|||||||
Reference in New Issue
Block a user