about summary refs log tree commit diff
path: root/spec/presenters
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-10-05 03:47:56 +0200
committerClaire <claire.github-309c@sitedethib.com>2022-10-09 19:51:39 +0200
commitbf3cb42da78a3f31a9e07167a764aa942ec73731 (patch)
tree5035a63d70172b51a8f70a7debb0f42107e63da4 /spec/presenters
parentc9fadb3caede626a371cc481cbe1f2dba0bec0c4 (diff)
Add server banner to web app, add `GET /api/v2/instance` to REST API (#19294)
Cherry-picked d2528b26b6da34f34b5d7a392e263428d3c09d69

Conflicts:
- `app/serializers/initial_state_serializer.rb`:
  Upstream changed stuff, we had extra attributes.
  Applied upstream changes while keeping our extra attributes.
- `app/serializers/rest/instance_serializer.rb`:
  Upstream actually moved that to `app/serializers/rest/v1/instance_serializer.rb`,
  so updated that file by keeping our extra attributes, and took upstream's
  version of `app/serializers/rest/instance_serializer.rb`.
- `spec/views/about/show.html.haml_spec.rb`:
  Took upstream's version.
Diffstat (limited to 'spec/presenters')
-rw-r--r--spec/presenters/instance_presenter_spec.rb38
1 files changed, 17 insertions, 21 deletions
diff --git a/spec/presenters/instance_presenter_spec.rb b/spec/presenters/instance_presenter_spec.rb
index 81d8d0e98..4baad03f4 100644
--- a/spec/presenters/instance_presenter_spec.rb
+++ b/spec/presenters/instance_presenter_spec.rb
@@ -3,21 +3,20 @@ require 'rails_helper'
 describe InstancePresenter do
   let(:instance_presenter) { InstancePresenter.new }
 
-  context do
+  describe '#description' do
     around do |example|
-      site_description = Setting.site_description
+      site_description = Setting.site_short_description
       example.run
-      Setting.site_description = site_description
+      Setting.site_short_description = site_description
     end
 
     it "delegates site_description to Setting" do
-      Setting.site_description = "Site desc"
-
-      expect(instance_presenter.site_description).to eq "Site desc"
+      Setting.site_short_description = "Site desc"
+      expect(instance_presenter.description).to eq "Site desc"
     end
   end
 
-  context do
+  describe '#extended_description' do
     around do |example|
       site_extended_description = Setting.site_extended_description
       example.run
@@ -26,12 +25,11 @@ describe InstancePresenter do
 
     it "delegates site_extended_description to Setting" do
       Setting.site_extended_description = "Extended desc"
-
-      expect(instance_presenter.site_extended_description).to eq "Extended desc"
+      expect(instance_presenter.extended_description).to eq "Extended desc"
     end
   end
 
-  context do
+  describe '#email' do
     around do |example|
       site_contact_email = Setting.site_contact_email
       example.run
@@ -40,12 +38,11 @@ describe InstancePresenter do
 
     it "delegates contact_email to Setting" do
       Setting.site_contact_email = "admin@example.com"
-
-      expect(instance_presenter.site_contact_email).to eq "admin@example.com"
+      expect(instance_presenter.contact.email).to eq "admin@example.com"
     end
   end
 
-  describe "contact_account" do
+  describe '#account' do
     around do |example|
       site_contact_username = Setting.site_contact_username
       example.run
@@ -55,12 +52,11 @@ describe InstancePresenter do
     it "returns the account for the site contact username" do
       Setting.site_contact_username = "aaa"
       account = Fabricate(:account, username: "aaa")
-
-      expect(instance_presenter.contact_account).to eq(account)
+      expect(instance_presenter.contact.account).to eq(account)
     end
   end
 
-  describe "user_count" do
+  describe '#user_count' do
     it "returns the number of site users" do
       Rails.cache.write 'user_count', 123
 
@@ -68,7 +64,7 @@ describe InstancePresenter do
     end
   end
 
-  describe "status_count" do
+  describe '#status_count' do
     it "returns the number of local statuses" do
       Rails.cache.write 'local_status_count', 234
 
@@ -76,7 +72,7 @@ describe InstancePresenter do
     end
   end
 
-  describe "domain_count" do
+  describe '#domain_count' do
     it "returns the number of known domains" do
       Rails.cache.write 'distinct_domain_count', 345
 
@@ -84,9 +80,9 @@ describe InstancePresenter do
     end
   end
 
-  describe '#version_number' do
-    it 'returns Mastodon::Version' do
-      expect(instance_presenter.version_number).to be(Mastodon::Version)
+  describe '#version' do
+    it 'returns string' do
+      expect(instance_presenter.version).to be_a String
     end
   end