Skip to content
Browse files

Merge pull request #11 from josh/multi_json

---

A few random things for 1.0

I wasnt sure where `ENV[RUBY_VERSION]` came from, travis? It wasnt in my environment so I couldnt `bundle install` without it. Thinking we should be using `RUBY_ENGINE` which is a standard constant.
  • Loading branch information...
2 parents 460d2dd + 9262347 commit 485b9b72e5a0f281bbd970a5c211aa5518225411 @joshk joshk committed Apr 18, 2011
Showing with 12 additions and 3 deletions.
  1. +2 −0 lib/multi_json.rb
  2. +2 −2 multi_json.gemspec
  3. +5 −0 spec/multi_json_spec.rb
  4. +3 −1 spec/spec_helper.rb
View
2 lib/multi_json.rb
@@ -2,6 +2,8 @@ module MultiJson
class DecodeError < StandardError; end
module_function
+ @engine = nil
+
# Get the current engine class.
def engine
return @engine if @engine
View
4 multi_json.gemspec
@@ -27,11 +27,11 @@ Gem::Specification.new do |s|
s.add_development_dependency("json", "~> 1.4")
s.add_development_dependency("json_pure", "~> 1.4")
- unless ENV['RUBY_VERSION'].match(/^rbx-/)
+ unless RUBY_ENGINE == "rbx"
s.add_development_dependency("rcov", "~> 0.9")
end
- unless ENV['RUBY_VERSION'].match(/^jruby-/)
+ unless RUBY_ENGINE == "jruby"
s.add_development_dependency("yajl-ruby", "~> 0.7")
end
end
View
5 spec/multi_json_spec.rb
@@ -53,6 +53,11 @@ def self.encode(string)
MultiJson.decode(MultiJson.encode(example)).should == example
end
end
+
+ it 'should encode symbol keys as strings' do
+ encoded_json = MultiJson.encode({ :foo => { :bar => 'baz' } })
+ MultiJson.decode(encoded_json).should == { 'foo' => { 'bar' => 'baz' } }
+ end
end
describe '.decode' do
View
4 spec/spec_helper.rb
@@ -4,6 +4,8 @@
puts "although not required, it's recommended that you use bundler during development"
end
-require 'multi_json'
require 'rspec'
require 'rspec/autorun'
+
+$VERBOSE = true
+require 'multi_json'

0 comments on commit 485b9b7

Please sign in to comment.
Something went wrong with that request. Please try again.