Skip to content

Commit 1b0d6ac

Browse files
committed
Add test case for situation without Mongoid and MongoMapper
1 parent 97a0f4c commit 1b0d6ac

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Diff for: test/lib/rails3-jquery-autocomplete/autocomplete_test.rb

+23
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@ module Rails3JQueryAutocomplete
44
class AutocompleteTest < Test::Unit::TestCase
55
include Rails3JQueryAutocomplete::Autocomplete
66

7+
context 'ClassMethods' do
8+
context '#autocomplete' do
9+
context '#get_prefix' do
10+
context 'Mongoid and MongoMapper is not defined' do
11+
setup do
12+
ActorsController = Class.new(ActionController::Base)
13+
ActorsController.autocomplete(:movie, :name)
14+
@controller = ActorsController.new
15+
16+
@model = Class.new(ActiveRecord::Base)
17+
18+
Object.send(:remove_const, :Mongoid)
19+
Object.send(:remove_const, :MongoMapper)
20+
end
21+
22+
should 'not raise exception' do
23+
@controller.get_prefix(@model)
24+
end
25+
end
26+
end
27+
end
28+
end
29+
730
context '#get_autocomplete_limit' do
831
context 'the limit option was specified' do
932
should "return the limit option" do

0 commit comments

Comments
 (0)