Skip to content

Commit

Permalink
add failing test for #566
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbrdo authored and shioyama committed Jun 18, 2022
1 parent b3d8806 commit ca9f048
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion spec/mobility/plugins/backend_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,31 @@
mod1 = translations_class.new("title", backend: backend_class_1)
model_class.include mod1

Class.new(model_class)
# accessing mobility_backend_classes necessary to trigger parent freeze
Class.new(model_class).send(:mobility_backend_classes)

expect(model_class.send(:mobility_backend_classes)).to be_frozen
end

it "works with subclasses of subclasses" do
backend_class_1 = Class.new
backend_class_1.include Mobility::Backend

model_subclass = Class.new(model_class)
model_subclass_2 = Class.new(model_subclass)

# we specifically include translations after subclassing
mod1 = translations_class.new("title", backend: backend_class_1)
model_class.include mod1

title_backend_class_1 = model_class.mobility_backend_class("title")
title_backend_class_2 = model_subclass.mobility_backend_class("title")
title_backend_class_3 = model_subclass_2.mobility_backend_class("title")

expect(title_backend_class_1).to be <(backend_class_1)
expect(title_backend_class_2).to be <(backend_class_1)
expect(title_backend_class_3).to be <(backend_class_1)
end
end

describe "#mobility_backends" do
Expand Down

0 comments on commit ca9f048

Please sign in to comment.