File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ def engine
2525 [ "json/pure" , :json_pure ]
2626 ]
2727
28+ DEFAULT_ENGINE_WARNING = 'Warning: multi_json is using default ok_json engine. Suggested action: require and load an appropriate JSON library.'
29+
2830 # The default engine based on what you currently
2931 # have loaded and installed. First checks to see
3032 # if any engines are already loaded, then checks
@@ -42,6 +44,7 @@ def default_engine
4244 end
4345 end
4446
47+ Kernel . warn DEFAULT_ENGINE_WARNING
4548 :ok_json
4649 end
4750
Original file line number Diff line number Diff line change 2626 it 'defaults to ok_json if no other json implementions are available' do
2727 MultiJson . default_engine . should == :ok_json
2828 end
29+
30+ it 'prints a warning' do
31+ Kernel . should_receive ( :warn ) . with ( /warning/i )
32+ MultiJson . default_engine
33+ end
2934 end
3035
3136 it 'defaults to the best available gem' do
You can’t perform that action at this time.
0 commit comments