mirror of
https://ghfast.top/https://github.com/discourse/discourse-topic-voting.git
synced 2026-07-18 11:39:58 +08:00
Renaming discourse_voting to topic_voting since there are two forms of voting in Discourse - posts and topics. This PR also moves a OnceOff into a post migration. The post migration will be executed, but should ideally be a no-op. This allows us to not have to maintain the OnceOff as it had to be modified before with a previous migration. I considered removing this file altogether, but I don't think there is anything negative from just converting it into a migration, and it might be useful in the unlikely scenario that a forum from the past has never ran the OnceOff before.
23 lines
583 B
Ruby
23 lines
583 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "rails_helper"
|
|
|
|
describe CategorySerializer do
|
|
fab!(:category)
|
|
|
|
it "does not return enable_topic_voting voting disabled" do
|
|
SiteSetting.topic_voting_enabled = false
|
|
|
|
json = CategorySerializer.new(category, root: false).as_json
|
|
|
|
expect(json[:custom_fields]).to eq({})
|
|
end
|
|
|
|
it "returns enable_topic_voting when voting enabled" do
|
|
SiteSetting.topic_voting_enabled = true
|
|
|
|
json = CategorySerializer.new(category, root: false).as_json
|
|
|
|
expect(json[:custom_fields]).to eq({ "enable_topic_voting" => false })
|
|
end
|
|
end
|