spec/api/adapters_spec.rb in sunspot-2.0.0 vs spec/api/adapters_spec.rb in sunspot-2.1.0
- old
+ new
@@ -12,10 +12,16 @@
it 'throws NoAdapterError if anonymous module passed in' do
lambda do
Sunspot::Adapters::InstanceAdapter::for(Module.new)
end.should raise_error(Sunspot::NoAdapterError)
end
+
+ it "registers adapters found by ancestor lookup with the descendant class" do
+ Sunspot::Adapters::InstanceAdapter::registered_adapter_for(UnseenModel).should be(nil)
+ Sunspot::Adapters::InstanceAdapter::for(UnseenModel)
+ Sunspot::Adapters::InstanceAdapter::registered_adapter_for(UnseenModel).should be(AbstractModelInstanceAdapter)
+ end
end
describe Sunspot::Adapters::DataAccessor do
it "finds adapter by superclass" do
Sunspot::Adapters::DataAccessor::for(Model).should be(AbstractModelDataAccessor)
@@ -27,9 +33,15 @@
it 'throws NoAdapterError if anonymous module passed in' do
lambda do
Sunspot::Adapters::DataAccessor::for(Module.new)
end.should raise_error(Sunspot::NoAdapterError)
+ end
+
+ it "registers adapters found by ancestor lookup with the descendant class" do
+ Sunspot::Adapters::DataAccessor::registered_accessor_for(UnseenModel).should be(nil)
+ Sunspot::Adapters::DataAccessor::for(UnseenModel)
+ Sunspot::Adapters::DataAccessor::registered_accessor_for(UnseenModel).should be(AbstractModelDataAccessor)
end
end
describe Sunspot::Adapters::Registry do
let(:registry){ Sunspot::Adapters::Registry.new }