mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 18:13:39 +08:00
Fixed test suite with PREFABRICATION=0 (#7574)
The issue here was that, with prefabrication, bumped_at was being persisted and then loaded and the DB was storing it with less precision than the object state.
This commit is contained in:
parent
6207b71c36
commit
cac7e43ba7
|
@ -932,7 +932,7 @@ describe Topic do
|
||||||
it 'should not be visible and have correct counts' do
|
it 'should not be visible and have correct counts' do
|
||||||
expect(topic).not_to be_visible
|
expect(topic).not_to be_visible
|
||||||
expect(topic.moderator_posts_count).to eq(1)
|
expect(topic.moderator_posts_count).to eq(1)
|
||||||
expect(topic.bumped_at.to_f).to eq(@original_bumped_at)
|
expect(topic.bumped_at.to_f).to be_within(1e-4).of(@original_bumped_at)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -946,7 +946,7 @@ describe Topic do
|
||||||
it 'should be visible with correct counts' do
|
it 'should be visible with correct counts' do
|
||||||
expect(topic).to be_visible
|
expect(topic).to be_visible
|
||||||
expect(topic.moderator_posts_count).to eq(1)
|
expect(topic.moderator_posts_count).to eq(1)
|
||||||
expect(topic.bumped_at.to_f).to eq(@original_bumped_at)
|
expect(topic.bumped_at.to_f).to be_within(1e-4).of(@original_bumped_at)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -961,7 +961,7 @@ describe Topic do
|
||||||
it "doesn't have a pinned_at but has correct dates" do
|
it "doesn't have a pinned_at but has correct dates" do
|
||||||
expect(topic.pinned_at).to be_blank
|
expect(topic.pinned_at).to be_blank
|
||||||
expect(topic.moderator_posts_count).to eq(1)
|
expect(topic.moderator_posts_count).to eq(1)
|
||||||
expect(topic.bumped_at.to_f).to eq(@original_bumped_at)
|
expect(topic.bumped_at.to_f).to be_within(1e-4).of(@original_bumped_at)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -974,7 +974,7 @@ describe Topic do
|
||||||
|
|
||||||
it 'should enable correctly' do
|
it 'should enable correctly' do
|
||||||
expect(topic.pinned_at).to be_present
|
expect(topic.pinned_at).to be_present
|
||||||
expect(topic.bumped_at.to_f).to eq(@original_bumped_at)
|
expect(topic.bumped_at.to_f).to be_within(1e-4).of(@original_bumped_at)
|
||||||
expect(topic.moderator_posts_count).to eq(1)
|
expect(topic.moderator_posts_count).to eq(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -992,7 +992,7 @@ describe Topic do
|
||||||
|
|
||||||
it 'should archive correctly' do
|
it 'should archive correctly' do
|
||||||
expect(@archived_topic).not_to be_archived
|
expect(@archived_topic).not_to be_archived
|
||||||
expect(@archived_topic.bumped_at.to_f).to be_within(0.1).of(@original_bumped_at)
|
expect(@archived_topic.bumped_at.to_f).to be_within(1e-4).of(@original_bumped_at)
|
||||||
expect(@archived_topic.moderator_posts_count).to eq(1)
|
expect(@archived_topic.moderator_posts_count).to eq(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1007,9 +1007,8 @@ describe Topic do
|
||||||
it 'should be archived' do
|
it 'should be archived' do
|
||||||
expect(topic).to be_archived
|
expect(topic).to be_archived
|
||||||
expect(topic.moderator_posts_count).to eq(1)
|
expect(topic.moderator_posts_count).to eq(1)
|
||||||
expect(topic.bumped_at.to_f).to eq(@original_bumped_at)
|
expect(topic.bumped_at.to_f).to be_within(1e-4).of(@original_bumped_at)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1025,9 +1024,8 @@ describe Topic do
|
||||||
it 'should not be pinned' do
|
it 'should not be pinned' do
|
||||||
expect(@closed_topic).not_to be_closed
|
expect(@closed_topic).not_to be_closed
|
||||||
expect(@closed_topic.moderator_posts_count).to eq(1)
|
expect(@closed_topic.moderator_posts_count).to eq(1)
|
||||||
expect(@closed_topic.bumped_at.to_f).not_to eq(@original_bumped_at)
|
expect(@closed_topic.bumped_at.to_f).not_to be_within(1e-4).of(@original_bumped_at)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'enable' do
|
context 'enable' do
|
||||||
|
@ -1039,7 +1037,7 @@ describe Topic do
|
||||||
|
|
||||||
it 'should be closed' do
|
it 'should be closed' do
|
||||||
expect(topic).to be_closed
|
expect(topic).to be_closed
|
||||||
expect(topic.bumped_at.to_f).to eq(@original_bumped_at)
|
expect(topic.bumped_at.to_f).to be_within(1e-4).of(@original_bumped_at)
|
||||||
expect(topic.moderator_posts_count).to eq(1)
|
expect(topic.moderator_posts_count).to eq(1)
|
||||||
expect(topic.topic_timers.first).to eq(nil)
|
expect(topic.topic_timers.first).to eq(nil)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user