mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
Ruby 2.2 fixes
This commit is contained in:
parent
8d03ff6f82
commit
ef62933034
3
Gemfile
3
Gemfile
|
@ -245,6 +245,9 @@ gem 'rbtrace', require: false, platform: :mri
|
||||||
gem 'ruby-readability', require: false
|
gem 'ruby-readability', require: false
|
||||||
|
|
||||||
gem 'simple-rss', 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 'gctools', require: false, platform: :mri_21
|
||||||
gem 'stackprof', require: false, platform: :mri_21
|
gem 'stackprof', require: false, platform: :mri_21
|
||||||
gem 'memory_profiler', require: false, platform: :mri_21
|
gem 'memory_profiler', require: false, platform: :mri_21
|
||||||
|
|
16
Gemfile.lock
16
Gemfile.lock
|
@ -45,7 +45,7 @@ GEM
|
||||||
ember-source
|
ember-source
|
||||||
execjs
|
execjs
|
||||||
handlebars-source (>= 1.0.0.rc.4)
|
handlebars-source (>= 1.0.0.rc.4)
|
||||||
better_errors (2.0.0)
|
better_errors (2.1.0)
|
||||||
coderay (>= 1.0.0)
|
coderay (>= 1.0.0)
|
||||||
erubis (>= 2.6.6)
|
erubis (>= 2.6.6)
|
||||||
rack (>= 0.9.0)
|
rack (>= 0.9.0)
|
||||||
|
@ -98,8 +98,8 @@ GEM
|
||||||
fast_xs (0.8.0)
|
fast_xs (0.8.0)
|
||||||
fastimage (1.6.3)
|
fastimage (1.6.3)
|
||||||
addressable (~> 2.3, >= 2.3.5)
|
addressable (~> 2.3, >= 2.3.5)
|
||||||
ffi (1.9.5)
|
ffi (1.9.6)
|
||||||
flamegraph (0.0.9)
|
flamegraph (0.1.0)
|
||||||
fast_stack
|
fast_stack
|
||||||
fog (1.22.1)
|
fog (1.22.1)
|
||||||
fog-brightbox
|
fog-brightbox
|
||||||
|
@ -134,7 +134,7 @@ GEM
|
||||||
highline (1.6.21)
|
highline (1.6.21)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
hiredis (0.5.2)
|
hiredis (0.5.2)
|
||||||
htmlentities (4.3.2)
|
htmlentities (4.3.3)
|
||||||
i18n (0.6.11)
|
i18n (0.6.11)
|
||||||
image_optim (0.9.1)
|
image_optim (0.9.1)
|
||||||
exifr (~> 1.1.3)
|
exifr (~> 1.1.3)
|
||||||
|
@ -196,7 +196,7 @@ GEM
|
||||||
multi_json (~> 1.3)
|
multi_json (~> 1.3)
|
||||||
multi_xml (~> 0.5)
|
multi_xml (~> 0.5)
|
||||||
rack (~> 1.2)
|
rack (~> 1.2)
|
||||||
oj (2.10.2)
|
oj (2.11.1)
|
||||||
omniauth (1.2.2)
|
omniauth (1.2.2)
|
||||||
hashie (>= 1.2, < 4)
|
hashie (>= 1.2, < 4)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
|
@ -273,8 +273,8 @@ GEM
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
raindrops (0.13.0)
|
raindrops (0.13.0)
|
||||||
rake (10.4.0)
|
rake (10.4.2)
|
||||||
rake-compiler (0.9.3)
|
rake-compiler (0.9.4)
|
||||||
rake
|
rake
|
||||||
rb-fsevent (0.9.4)
|
rb-fsevent (0.9.4)
|
||||||
rb-inotify (0.9.5)
|
rb-inotify (0.9.5)
|
||||||
|
@ -284,7 +284,7 @@ GEM
|
||||||
msgpack (>= 0.4.3)
|
msgpack (>= 0.4.3)
|
||||||
trollop (>= 1.16.2)
|
trollop (>= 1.16.2)
|
||||||
redcarpet (3.1.2)
|
redcarpet (3.1.2)
|
||||||
redis (3.1.0)
|
redis (3.2.0)
|
||||||
redis-namespace (1.5.1)
|
redis-namespace (1.5.1)
|
||||||
redis (~> 3.0, >= 3.0.4)
|
redis (~> 3.0, >= 3.0.4)
|
||||||
ref (1.0.5)
|
ref (1.0.5)
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
if Rails.configuration.respond_to?(:load_mini_profiler) && Rails.configuration.load_mini_profiler
|
if Rails.configuration.respond_to?(:load_mini_profiler) && Rails.configuration.load_mini_profiler
|
||||||
require 'rack-mini-profiler'
|
require 'rack-mini-profiler'
|
||||||
require 'flamegraph'
|
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
|
# initialization is skipped so trigger it
|
||||||
Rack::MiniProfilerRails.initialize!(Rails.application)
|
Rack::MiniProfilerRails.initialize!(Rails.application)
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,6 +34,20 @@ describe DiscourseSingleSignOn do
|
||||||
parsed.custom_fields["b.b"].should == "B.b"
|
parsed.custom_fields["b.b"].should == "B.b"
|
||||||
end
|
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
|
it "can lookup or create user when name is blank" do
|
||||||
# so we can create system messages
|
# so we can create system messages
|
||||||
Fabricate(:admin)
|
Fabricate(:admin)
|
||||||
|
|
|
@ -110,8 +110,11 @@ Spork.prefork do
|
||||||
end
|
end
|
||||||
|
|
||||||
def freeze_time(now=Time.now)
|
def freeze_time(now=Time.now)
|
||||||
DateTime.stubs(:now).returns(DateTime.parse(now.to_s))
|
datetime = DateTime.parse(now.to_s)
|
||||||
Time.stubs(:now).returns(Time.parse(now.to_s))
|
time = Time.parse(now.to_s)
|
||||||
|
|
||||||
|
DateTime.stubs(:now).returns(datetime)
|
||||||
|
Time.stubs(:now).returns(time)
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_from_fixtures(filename)
|
def file_from_fixtures(filename)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user