~cytrogen/masto-fe

ref: 685270f3f7ea6d4a8a48ec641e8fdfd9fc2e2d7f masto-fe/spec/models/form/admin_settings_spec.rb -rw-r--r-- 1.0 KiB
685270f3 — Claire [Glitch] Fix clicking “Explore” or “Live feeds” column headers to scroll in advanced mode 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true

require 'rails_helper'

describe Form::AdminSettings do
  describe 'validations' do
    describe 'site_contact_username' do
      context 'with no accounts' do
        it 'is not valid' do
          setting = described_class.new(site_contact_username: 'Test')
          setting.valid?

          expect(setting).to model_have_error_on_field(:site_contact_username)
        end
      end

      context 'with an account' do
        before { Fabricate(:account, username: 'Glorp') }

        it 'is not valid when account doesnt match' do
          setting = described_class.new(site_contact_username: 'Test')
          setting.valid?

          expect(setting).to model_have_error_on_field(:site_contact_username)
        end

        it 'is valid when account matches' do
          setting = described_class.new(site_contact_username: 'Glorp')
          setting.valid?

          expect(setting).to_not model_have_error_on_field(:site_contact_username)
        end
      end
    end
  end
end