debian-mirror-gitlab/elasticsearch-model/spec/elasticsearch/model/callbacks_spec.rb

34 lines
732 B
Ruby
Raw Normal View History

2020-03-09 13:42:32 +05:30
require 'spec_helper'
describe Elasticsearch::Model::Callbacks do
before(:all) do
class ::DummyCallbacksModel
end
module DummyCallbacksAdapter
module CallbacksMixin
end
def callbacks_mixin
CallbacksMixin
end; module_function :callbacks_mixin
end
end
after(:all) do
remove_classes(DummyCallbacksModel, DummyCallbacksAdapter)
end
context 'when a model includes the Callbacks module' do
before do
Elasticsearch::Model::Callbacks.included(DummyCallbacksModel)
end
it 'includes the callbacks mixin from the model adapter' do
expect(DummyCallbacksModel.ancestors).to include(Elasticsearch::Model::Adapter::Default::Callbacks)
end
end
end