Ruby 2.2 fixes

This commit is contained in:
Sam 2014-12-29 13:30:54 +11:00
parent 8d03ff6f82
commit ef62933034
5 changed files with 34 additions and 11 deletions

View File

@ -245,6 +245,9 @@ gem 'rbtrace', require: false, platform: :mri
gem 'ruby-readability', require: false
gem 'simple-rss', require: false
# TODO mri_22 should be here, but bundler was real slow to pick it up
# not even in production bundler yet, monkey patching it in feels bad
gem 'gctools', require: false, platform: :mri_21
gem 'stackprof', require: false, platform: :mri_21
gem 'memory_profiler', require: false, platform: :mri_21

View File

@ -45,7 +45,7 @@ GEM
ember-source
execjs
handlebars-source (>= 1.0.0.rc.4)
better_errors (2.0.0)
better_errors (2.1.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
rack (>= 0.9.0)
@ -98,8 +98,8 @@ GEM
fast_xs (0.8.0)
fastimage (1.6.3)
addressable (~> 2.3, >= 2.3.5)
ffi (1.9.5)
flamegraph (0.0.9)
ffi (1.9.6)
flamegraph (0.1.0)
fast_stack
fog (1.22.1)
fog-brightbox
@ -134,7 +134,7 @@ GEM
highline (1.6.21)
hike (1.2.3)
hiredis (0.5.2)
htmlentities (4.3.2)
htmlentities (4.3.3)
i18n (0.6.11)
image_optim (0.9.1)
exifr (~> 1.1.3)
@ -196,7 +196,7 @@ GEM
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (~> 1.2)
oj (2.10.2)
oj (2.11.1)
omniauth (1.2.2)
hashie (>= 1.2, < 4)
rack (~> 1.0)
@ -273,8 +273,8 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.13.0)
rake (10.4.0)
rake-compiler (0.9.3)
rake (10.4.2)
rake-compiler (0.9.4)
rake
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
@ -284,7 +284,7 @@ GEM
msgpack (>= 0.4.3)
trollop (>= 1.16.2)
redcarpet (3.1.2)
redis (3.1.0)
redis (3.2.0)
redis-namespace (1.5.1)
redis (~> 3.0, >= 3.0.4)
ref (1.0.5)

View File

@ -2,7 +2,10 @@
if Rails.configuration.respond_to?(:load_mini_profiler) && Rails.configuration.load_mini_profiler
require 'rack-mini-profiler'
require 'flamegraph'
require 'memory_profiler' if RUBY_VERSION >= "2.1.0"
# TODO support Ruby 2.2 once bundler fixes itself
require 'memory_profiler' if RUBY_VERSION >= "2.1.0" && RUBY_VERSION < "2.2.0"
# initialization is skipped so trigger it
Rack::MiniProfilerRails.initialize!(Rails.application)
end

View File

@ -34,6 +34,20 @@ describe DiscourseSingleSignOn do
parsed.custom_fields["b.b"].should == "B.b"
end
it "can do round trip parsing correctly" do
sso = SingleSignOn.new
sso.sso_secret = "test"
sso.name = "sam saffron"
sso.username = "sam"
sso.email = "sam@sam.com"
sso = SingleSignOn.parse(sso.payload, "test")
sso.name.should == "sam saffron"
sso.username.should == "sam"
sso.email.should == "sam@sam.com"
end
it "can lookup or create user when name is blank" do
# so we can create system messages
Fabricate(:admin)

View File

@ -110,8 +110,11 @@ Spork.prefork do
end
def freeze_time(now=Time.now)
DateTime.stubs(:now).returns(DateTime.parse(now.to_s))
Time.stubs(:now).returns(Time.parse(now.to_s))
datetime = DateTime.parse(now.to_s)
time = Time.parse(now.to_s)
DateTime.stubs(:now).returns(datetime)
Time.stubs(:now).returns(time)
end
def file_from_fixtures(filename)