Skip to content

Commit

Permalink
updating spec results
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Plentz committed Feb 8, 2012
1 parent a2d85a4 commit 8547a0d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 64 deletions.
8 changes: 4 additions & 4 deletions Gemfile
Expand Up @@ -7,9 +7,9 @@ gem 'multi_json'
gem 'json', :require => false
gem 'yajl-ruby', :require => false

gem 'sqlite3-ruby', :platforms => :ruby

platforms :jruby do
gem 'activerecord-jdbc-adapter', :git => 'git://github.com/nicksieger/activerecord-jdbc-adapter.git'
if RUBY_PLATFORM == "java"
gem 'activerecord-jdbc-adapter'
gem 'activerecord-jdbcsqlite3-adapter'
else
gem 'sqlite3-ruby'
end
21 changes: 6 additions & 15 deletions Gemfile.lock
@@ -1,13 +1,3 @@
GIT
remote: git://github.com/nicksieger/activerecord-jdbc-adapter.git
revision: fc54124b9ebec41e609646526b8bd97c708e20d5
specs:
activerecord-jdbc-adapter (1.2.0)
activerecord-jdbcsqlite3-adapter (1.2.0)
activerecord-jdbc-adapter (~> 1.2.0)
jdbc-sqlite3 (~> 3.7.2)
jdbc-sqlite3 (3.7.2)

GEM
remote: http://rubygems.org/
specs:
Expand All @@ -32,6 +22,10 @@ GEM
activesupport (= 3.2.1)
arel (~> 3.0.0)
tzinfo (~> 0.3.29)
activerecord-jdbc-adapter (1.2.2)
activerecord-jdbcsqlite3-adapter (1.2.2)
activerecord-jdbc-adapter (~> 1.2.2)
jdbc-sqlite3 (~> 3.7.2)
activeresource (3.2.1)
activemodel (= 3.2.1)
activesupport (= 3.2.1)
Expand All @@ -44,6 +38,7 @@ GEM
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.0)
jdbc-sqlite3 (3.7.2)
journey (1.0.1)
json (1.6.5)
json (1.6.5-java)
Expand Down Expand Up @@ -96,9 +91,6 @@ GEM
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
Expand All @@ -112,11 +104,10 @@ PLATFORMS
ruby

DEPENDENCIES
activerecord-jdbc-adapter!
activerecord-jdbc-adapter
activerecord-jdbcsqlite3-adapter
json
multi_json
rails (= 3.2.1)
rspec-rails
sqlite3-ruby
yajl-ruby
76 changes: 33 additions & 43 deletions README.md
@@ -1,77 +1,67 @@
JRuby 1.6.4(1.9 mode) doesn't work the same way then MRI 1.9.2p290 in these tests. Tried to isolate as much as possible each one.
JRuby 1.6.6(1.9 mode) doesn't work the same way then MRI 1.9.3p0 in these tests. Tried to isolate as much as possible each one.

***
### Ruby MRI 1.9.2p290
### Ruby MRI 1.9.3p0

````
~/Projects/opensource/jruby_report (master) $ rspec spec
No DRb server is running. Running in local process instead ...
F...
MultiJson::Engines::Yajl
.....
Failures:
1) charpoint should generate the same charpoint in both runtimes
Failure/Error: MultiJson.encode({:message => "á"}).should == "{\"message\":\"á\"}"
expected: "{\"message\":\"á\"}"
got: "{\"message\":\"\\u00e1\"}" (using ==)
# ./spec/models/charpoints_spec.rb:9:in `block (2 levels) in <top (required)>'
Finished in 0.02677 seconds
4 examples, 1 failure
Failed examples:
rspec ./spec/models/charpoints_spec.rb:8 # charpoint should generate the same charpoint in both runtimes
Finished in 0.01431 seconds
5 examples, 0 failures
````

***
### JRuby 1.6.4(1.9 mode)
### JRuby 1.6.6(1.9 mode)

````
~/Projects/opensource/jruby_report (master) $ jruby --1.9 -S rspec spec/models/foo_spec.rb
^C~/Projects/opensource/jruby_report (master) $ jruby --1.9 -S rspec spec
~/Projects/opensource/jruby_report (master) $ jruby --1.9 -S rspec spec
No DRb server is running. Running in local process instead ...
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
FF.F
MultiJson::Engines::JsonGem
F.FFF
Failures:
1) charpoint should generate the same charpoint in both runtimes
Failure/Error: MultiJson.encode({:message => "á"}).should == "{\"message\":\"á\"}"
expected: "{\"message\":\"á\"}"
got: "{\"message\":\"\\ufffd\"}" (using ==)
got: "{\"message\":\"\\u00e1\"}" (using ==)
# ./spec/models/charpoints_spec.rb:9:in `(root)'
# org/jruby/RubyBasicObject.java:1717:in `instance_eval'
# org/jruby/RubyArray.java:2344:in `collect'
# org/jruby/RubyArray.java:2344:in `collect'
2) Foo should do the right interpolation for error messages
Failure/Error: lambda{I18n.t("errors.messages.record_invalid", :errors => foo.errors.full_messages)}.should_not raise_error
expected no Exception, got #<Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT>
# ./spec/models/foo_spec.rb:9:in `(root)'
# org/jruby/RubyBasicObject.java:1717:in `instance_eval'
# org/jruby/RubyArray.java:2344:in `collect'
# org/jruby/RubyArray.java:2344:in `collect'
2) MultiJson.engine should decode json even with special chars using a json string directly
Failure/Error: MultiJson.decode("{\"message\":\"á\"}")['message'].should eq "á"
expected: "á"
got: "\u00C3\u00A1"
(compared using ==)
# ./spec/models/json_spec.rb:33:in `(root)'
3) jruby json should decode json even with special chars using to_json
3) MultiJson.engine should decode json even with special chars using to_json
Failure/Error: MultiJson.decode({:message => "á"}.to_json)['message'].should eq "á"
expected "á"
got "\xC3\xA1"
expected: "á"
got: "\u00C3\u00A1"
(compared using ==)
# ./spec/models/json_spec.rb:14:in `(root)'
# org/jruby/RubyBasicObject.java:1717:in `instance_eval'
# org/jruby/RubyArray.java:2344:in `collect'
# org/jruby/RubyArray.java:2344:in `collect'
# ./spec/models/json_spec.rb:37:in `(root)'
4) MultiJson.engine should decode json even with special chars using to_json
Failure/Error: MultiJson.encode({a:"á"}).should match /á/
expected "{\"a\":\"\\u00e1\"}" to match /á/
# ./spec/models/json_spec.rb:41:in `(root)'
Finished in 0.475 seconds
4 examples, 3 failures
Finished in 0.203 seconds
5 examples, 4 failures
Failed examples:
rspec ./spec/models/charpoints_spec.rb:8 # charpoint should generate the same charpoint in both runtimes
rspec ./spec/models/foo_spec.rb:6 # Foo should do the right interpolation for error messages
rspec ./spec/models/json_spec.rb:13 # jruby json should decode json even with special chars using to_json
rspec ./spec/models/json_spec.rb:32 # MultiJson.engine should decode json even with special chars using a json string directly
rspec ./spec/models/json_spec.rb:36 # MultiJson.engine should decode json even with special chars using to_json
rspec ./spec/models/json_spec.rb:40 # MultiJson.engine should decode json even with special chars using to_json
````
4 changes: 2 additions & 2 deletions spec/models/json_spec.rb
Expand Up @@ -7,12 +7,12 @@
# there's 2 methods of changing MultiJson(the lib used by rails to handle json) engines.
# One is to require the lib directly and the other is to set MultiJson.engine =, but
# the behavior is different for each one. Above each method I've put if it works or
# fails after testing using jruby 1.6.4 and mri 1.9.2p290
# fails after testing using jruby 1.6.6 and mri 1.9.3p0

#pass in both
#require 'json/pure'
#fail only in jruby
#require 'yajl'
require 'yajl'
#fail in both
#require 'json'
#fail in both
Expand Down

0 comments on commit 8547a0d

Please sign in to comment.