mirror of
https://ghfast.top/https://github.com/discourse/discourse-topic-voting.git
synced 2026-07-17 11:37:03 +08:00
23 lines
571 B
Ruby
23 lines
571 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.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.voting_enabled = true
|
|
|
|
json = CategorySerializer.new(category, root: false).as_json
|
|
|
|
expect(json[:custom_fields]).to eq({ "enable_topic_voting" => false })
|
|
end
|
|
end
|