Skip to content

Commit

Permalink
Remove stdlib warning since it's doing more harm than good
Browse files Browse the repository at this point in the history
  • Loading branch information
rwz committed Jun 1, 2013
1 parent 6f29bb1 commit d06eec6
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 37 deletions.
10 changes: 0 additions & 10 deletions lib/multi_json/adapters/json_common.rb
Expand Up @@ -5,16 +5,6 @@ module Adapters
class JsonCommon < Adapter
defaults :load, :create_additions => false, :quirks_mode => true

GEM_VERSION = '1.7.7'

def activate
if JSON::VERSION < GEM_VERSION
Kernel.warn "You are using an old or stdlib version of #{gem_name} gem\n" +
"Please upgrade to the recent version by adding this to your Gemfile:\n\n" +
" gem '#{gem_name}', '~> #{GEM_VERSION}'\n"
end
end

def load(string, options={})
string = string.read if string.respond_to?(:read)

Expand Down
4 changes: 0 additions & 4 deletions lib/multi_json/adapters/json_gem.rb
Expand Up @@ -6,10 +6,6 @@ module Adapters
# Use the JSON gem to dump/load.
class JsonGem < JsonCommon
ParseError = ::JSON::ParserError

def gem_name
'json'
end
end
end
end
4 changes: 0 additions & 4 deletions lib/multi_json/adapters/json_pure.rb
Expand Up @@ -6,10 +6,6 @@ module Adapters
# Use JSON pure to dump/load.
class JsonPure < JsonCommon
ParseError = ::JSON::ParserError

def gem_name
'json_pure'
end
end
end
end
19 changes: 0 additions & 19 deletions spec/multi_json_spec.rb
Expand Up @@ -62,25 +62,6 @@
end
end

context 'with stdlib version' do
around do |example|
version = JSON::VERSION
silence_warnings{ JSON::VERSION = '1.5.5' }
example.call
silence_warnings{ JSON::VERSION = version }
end

it 'should warn about json' do
Kernel.should_receive(:warn).with(/'json', '~> 1.7.7'/)
MultiJson.use :json_gem
end

it 'should warn about json/pure' do
Kernel.should_receive(:warn).with(/'json_pure', '~> 1.7.7'/)
MultiJson.use :json_pure
end
end

it 'defaults to the best available gem' do
# Clear cache variable already set by previous tests
MultiJson.send(:remove_instance_variable, :@adapter)
Expand Down

0 comments on commit d06eec6

Please sign in to comment.