mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 21:43:45 +08:00
b3d769ff4f
update rspec syntax to v3 change syntax to rspec v3 oops. fix typo mailers classes with rspec3 syntax helpers with rspec3 syntax jobs with rspec3 syntax serializers with rspec3 syntax views with rspec3 syntax support to rspec3 syntax category spec with rspec3 syntax
32 lines
858 B
Ruby
32 lines
858 B
Ruby
require 'spec_helper'
|
|
|
|
describe TopicFeaturedUsers do
|
|
it 'ensures consistenct' do
|
|
|
|
t = Fabricate(:topic)
|
|
Fabricate(:post, topic_id: t.id, user_id: t.user_id)
|
|
p2 = Fabricate(:post, topic_id: t.id)
|
|
Fabricate(:post, topic_id: t.id, user_id: p2.user_id)
|
|
p4 = Fabricate(:post, topic_id: t.id)
|
|
p5 = Fabricate(:post, topic_id: t.id)
|
|
|
|
t.update_columns(featured_user1_id: 66,
|
|
featured_user2_id: 70,
|
|
featured_user3_id: 12,
|
|
featured_user4_id: 7,
|
|
last_post_user_id: p5.user_id
|
|
)
|
|
|
|
TopicFeaturedUsers.ensure_consistency!
|
|
|
|
t.reload
|
|
|
|
expect(t.featured_user1_id).to eq(p2.user_id)
|
|
expect(t.featured_user2_id).to eq(p4.user_id)
|
|
expect(t.featured_user3_id).to eq(nil)
|
|
expect(t.featured_user4_id).to eq(nil)
|
|
|
|
|
|
end
|
|
end
|