DEV: correct spec failures in PG 12
PG 12 changes internals in a subtle way, time jitter is noticed in a few new spots (which is normal) and default ordering is a bit different which is meant to be random anyway.
This commit is contained in:
parent
e0199e8094
commit
ebc82eb63e
|
@ -15,13 +15,13 @@ describe FreedomPatches::SchemaMigrationDetails do
|
|||
end
|
||||
|
||||
it "logs information on migration" do
|
||||
migration = TestMigration.new("awesome_migration", "20160225050318")
|
||||
migration = TestMigration.new("awesome_migration", "20110225050318")
|
||||
|
||||
ActiveRecord::Base.connection_pool.with_connection do |conn|
|
||||
migration.exec_migration(conn, :up)
|
||||
end
|
||||
|
||||
info = SchemaMigrationDetail.find_by(version: "20160225050318")
|
||||
info = SchemaMigrationDetail.find_by(version: "20110225050318")
|
||||
|
||||
expect(info.duration).to be > 0
|
||||
expect(info.git_version).to eq Discourse.git_version
|
||||
|
|
|
@ -91,8 +91,8 @@ describe TopTopic do
|
|||
top_topics = TopTopic.all
|
||||
|
||||
expect(top_topics.where(topic_id: topic_1.id).pluck_first(:yearly_score)).to eq(27)
|
||||
expect(top_topics.where(topic_id: topic_2.id).pluck_first(:yearly_score)).to eq(18.301029995664)
|
||||
expect(top_topics.where(topic_id: topic_3.id).pluck_first(:yearly_score)).to eq(11.2041199826559)
|
||||
expect(top_topics.where(topic_id: topic_2.id).pluck_first(:yearly_score)).to be_within(0.0000000001).of(18.301029995664)
|
||||
expect(top_topics.where(topic_id: topic_3.id).pluck_first(:yearly_score)).to be_within(0.0000000001).of(11.2041199826559)
|
||||
|
||||
# when 'top_topics_formula_first_post_likes_multiplier' setting is changed
|
||||
SiteSetting.top_topics_formula_log_views_multiplier = 2 # unchanged
|
||||
|
@ -109,8 +109,8 @@ describe TopTopic do
|
|||
top_topics = TopTopic.all
|
||||
|
||||
expect(top_topics.where(topic_id: topic_1.id).pluck_first(:yearly_score)).to eq(69)
|
||||
expect(top_topics.where(topic_id: topic_2.id).pluck_first(:yearly_score)).to eq(33.301029995664)
|
||||
expect(top_topics.where(topic_id: topic_3.id).pluck_first(:yearly_score)).to eq(10.602059991328)
|
||||
expect(top_topics.where(topic_id: topic_2.id).pluck_first(:yearly_score)).to be_within(0.0000000001).of(33.301029995664)
|
||||
expect(top_topics.where(topic_id: topic_3.id).pluck_first(:yearly_score)).to be_within(0.0000000001).of(10.602059991328)
|
||||
|
||||
# when 'top_topics_formula_least_likes_per_post_multiplier' setting is changed
|
||||
SiteSetting.top_topics_formula_log_views_multiplier = 2 # unchanged
|
||||
|
@ -127,8 +127,8 @@ describe TopTopic do
|
|||
top_topics = TopTopic.all
|
||||
|
||||
expect(top_topics.where(topic_id: topic_1.id).pluck_first(:yearly_score)).to eq(30)
|
||||
expect(top_topics.where(topic_id: topic_2.id).pluck_first(:yearly_score)).to eq(21.301029995664)
|
||||
expect(top_topics.where(topic_id: topic_3.id).pluck_first(:yearly_score)).to eq(10.602059991328)
|
||||
expect(top_topics.where(topic_id: topic_2.id).pluck_first(:yearly_score)).to be_within(0.0000000001).of(21.301029995664)
|
||||
expect(top_topics.where(topic_id: topic_3.id).pluck_first(:yearly_score)).to be_within(0.0000000001).of(10.602059991328)
|
||||
|
||||
# handles invalid string value
|
||||
SiteSetting.top_topics_formula_log_views_multiplier = "not good"
|
||||
|
@ -139,8 +139,8 @@ describe TopTopic do
|
|||
top_topics = TopTopic.all
|
||||
|
||||
expect(top_topics.where(topic_id: topic_1.id).pluck_first(:yearly_score)).to eq(27)
|
||||
expect(top_topics.where(topic_id: topic_2.id).pluck_first(:yearly_score)).to eq(18.301029995664)
|
||||
expect(top_topics.where(topic_id: topic_3.id).pluck_first(:yearly_score)).to eq(10.602059991328)
|
||||
expect(top_topics.where(topic_id: topic_2.id).pluck_first(:yearly_score)).to be_within(0.0000000001).of(18.301029995664)
|
||||
expect(top_topics.where(topic_id: topic_3.id).pluck_first(:yearly_score)).to be_within(0.0000000001).of(10.602059991328)
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue