mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Add support for Rails 6
Minor fixes to add Rails 6 support to Discourse, we now will boot with RAILS_MASTER=1, all specs pass Only one tiny deprecation left Largest change was the way ActiveModel:Errors changed interface a bit but there is a simple backwards compat way of working it
This commit is contained in:
@@ -22,10 +22,10 @@ describe HasCustomFields do
|
||||
DB.exec("drop table custom_fields_test_items")
|
||||
DB.exec("drop table custom_fields_test_item_custom_fields")
|
||||
|
||||
# import is making my life hard, we need to nuke this out of orbit
|
||||
des = ActiveSupport::DescendantsTracker.class_variable_get :@@direct_descendants
|
||||
des[ActiveRecord::Base].delete(CustomFieldsTestItem)
|
||||
des[ActiveRecord::Base].delete(CustomFieldsTestItemCustomField)
|
||||
# this weakref in the descendant tracker should clean up the two tests
|
||||
# if this becomes an issue we can revisit (watch out for erratic tests)
|
||||
Object.send(:remove_const, :CustomFieldsTestItem)
|
||||
Object.send(:remove_const, :CustomFieldsTestItemCustomField)
|
||||
end
|
||||
|
||||
it "simple modification of custom fields" do
|
||||
|
||||
@@ -21,10 +21,10 @@ describe HasSearchData do
|
||||
DB.exec("drop table model_items")
|
||||
DB.exec("drop table model_item_search_data")
|
||||
|
||||
# import is making my life hard, we need to nuke this out of orbit
|
||||
des = ActiveSupport::DescendantsTracker.class_variable_get :@@direct_descendants
|
||||
des[ActiveRecord::Base].delete(ModelItem)
|
||||
des[ActiveRecord::Base].delete(ModelItemSearchData)
|
||||
# this weakref in the descendant tracker should clean up the two tests
|
||||
# if this becomes an issue we can revisit (watch out for erratic tests)
|
||||
Object.send(:remove_const, :ModelItem)
|
||||
Object.send(:remove_const, :ModelItemSearchData)
|
||||
end
|
||||
|
||||
let(:item) do
|
||||
|
||||
@@ -20,9 +20,9 @@ describe Positionable do
|
||||
after do
|
||||
DB.exec("drop table test_items")
|
||||
|
||||
# import is making my life hard, we need to nuke this out of orbit
|
||||
des = ActiveSupport::DescendantsTracker.class_variable_get :@@direct_descendants
|
||||
des[ActiveRecord::Base].delete(TestItem)
|
||||
# this weakref in the descendant tracker should clean up the two tests
|
||||
# if this becomes an issue we can revisit (watch out for erratic tests)
|
||||
Object.send(:remove_const, :TestItem)
|
||||
end
|
||||
|
||||
it "can position stuff correctly" do
|
||||
|
||||
@@ -22,10 +22,10 @@ describe Searchable do
|
||||
DB.exec("drop table searchable_records")
|
||||
DB.exec("drop table searchable_record_search_data")
|
||||
|
||||
# import is making my life hard, we need to nuke this out of orbit
|
||||
des = ActiveSupport::DescendantsTracker.class_variable_get :@@direct_descendants
|
||||
des[ActiveRecord::Base].delete(SearchableRecord)
|
||||
des[ActiveRecord::Base].delete(SearchableRecordSearchData)
|
||||
# this weakref in the descendant tracker should clean up the two tests
|
||||
# if this becomes an issue we can revisit (watch out for erratic tests)
|
||||
Object.send(:remove_const, :SearchableRecord)
|
||||
Object.send(:remove_const, :SearchableRecordSearchData)
|
||||
end
|
||||
|
||||
let(:item) { SearchableRecord.create! }
|
||||
|
||||
@@ -227,7 +227,7 @@ describe Validators::PostValidator do
|
||||
|
||||
it "should add an error" do
|
||||
validator.unique_post_validator(new_post)
|
||||
expect(new_post.errors.keys).to contain_exactly(:raw)
|
||||
expect(new_post.errors.to_hash.keys).to contain_exactly(:raw)
|
||||
end
|
||||
|
||||
it "should not add an error if post.skip_unique_check is true" do
|
||||
|
||||
Reference in New Issue
Block a user