mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:44:40 +08:00
DEV: Replace const munging in specs with stub_const helper
This commit is contained in:

committed by
Alan Guo Xiang Tan

parent
06fa1efd3d
commit
53dab8cf1e
@ -802,19 +802,12 @@ describe TopicView do
|
||||
|
||||
describe 'for mega topics' do
|
||||
it 'should return the right columns' do
|
||||
begin
|
||||
original_const = TopicView::MEGA_TOPIC_POSTS_COUNT
|
||||
TopicView.send(:remove_const, "MEGA_TOPIC_POSTS_COUNT")
|
||||
TopicView.const_set("MEGA_TOPIC_POSTS_COUNT", 2)
|
||||
|
||||
stub_const(TopicView, "MEGA_TOPIC_POSTS_COUNT", 2) do
|
||||
expect(topic_view.filtered_post_stream).to eq([
|
||||
post.id,
|
||||
post2.id,
|
||||
post3.id
|
||||
])
|
||||
ensure
|
||||
TopicView.send(:remove_const, "MEGA_TOPIC_POSTS_COUNT")
|
||||
TopicView.const_set("MEGA_TOPIC_POSTS_COUNT", original_const)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user