Add user count to instance API (#14543)
* Add user count to instance API * Use estimated_count
This commit is contained in:
parent
5d4475549b
commit
bcd804f44d
2 changed files with 3 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ module Api
|
|||
description: Settings::Community.community_description,
|
||||
logo_image_url: Settings::General.logo_png,
|
||||
name: Settings::Community.community_name,
|
||||
registered_users_count: User.registered.estimated_count,
|
||||
tagline: Settings::Community.tagline,
|
||||
version: "edge.#{Time.now.utc.strftime('%Y%m%d')}.0",
|
||||
visibility: visibility
|
||||
|
|
|
|||
|
|
@ -3,12 +3,14 @@ require "rails_helper"
|
|||
RSpec.describe "Api::V0::Instances", type: :request do
|
||||
describe "GET /api/instance" do
|
||||
it "returns the correct attributes", :aggregate_failures do
|
||||
create(:user)
|
||||
get api_instance_path
|
||||
|
||||
expect(response.parsed_body["cover_image_url"]).to eq Settings::General.main_social_image
|
||||
expect(response.parsed_body["description"]).to eq Settings::Community.community_description
|
||||
expect(response.parsed_body["logo_image_url"]).to eq Settings::General.logo_png
|
||||
expect(response.parsed_body["name"]).to eq Settings::Community.community_name
|
||||
expect(response.parsed_body["registered_users_count"]).to eq User.registered.estimated_count
|
||||
expect(response.parsed_body["tagline"]).to eq Settings::Community.tagline
|
||||
expect(response.parsed_body["version"]).to match(/(stable|beta|edge)\.\d{8}\.\d+/)
|
||||
expect(response.parsed_body["visibility"]).to eq "public"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue