diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-06-23 12:49:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 12:49:09 +0200 |
commit | 776e00f19399875a135a64d8ad486f3578101cf9 (patch) | |
tree | ea846e21767b1cb2f9f277d3829fbade1f0e46a0 /spec | |
parent | a434f370f38ac66e05000545e36d7c696f4962d0 (diff) | |
parent | 979059fbc93664b38b720b369b31beaa89457879 (diff) |
Merge pull request #1551 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/follower_accounts_controller_spec.rb | 19 | ||||
-rw-r--r-- | spec/controllers/following_accounts_controller_spec.rb | 19 | ||||
-rw-r--r-- | spec/fabricators/login_activity_fabricator.rb | 8 | ||||
-rw-r--r-- | spec/models/login_activity_spec.rb | 5 |
4 files changed, 49 insertions, 2 deletions
diff --git a/spec/controllers/follower_accounts_controller_spec.rb b/spec/controllers/follower_accounts_controller_spec.rb index f6d55f693..006274169 100644 --- a/spec/controllers/follower_accounts_controller_spec.rb +++ b/spec/controllers/follower_accounts_controller_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe FollowerAccountsController do render_views - let(:alice) { Fabricate(:account, username: 'alice') } + let(:alice) { Fabricate(:user).account } let(:follower0) { Fabricate(:account) } let(:follower1) { Fabricate(:account) } @@ -101,6 +101,23 @@ describe FollowerAccountsController do expect(body['partOf']).to be_blank end + context 'when account hides their network' do + before do + alice.user.settings.hide_network = true + end + + it 'returns followers count' do + expect(body['totalItems']).to eq 2 + end + + it 'does not return items' do + expect(body['items']).to be_blank + expect(body['orderedItems']).to be_blank + expect(body['first']).to be_blank + expect(body['last']).to be_blank + end + end + context 'when account is permanently suspended' do before do alice.suspend! diff --git a/spec/controllers/following_accounts_controller_spec.rb b/spec/controllers/following_accounts_controller_spec.rb index 0fc0967a6..7ec0e3d06 100644 --- a/spec/controllers/following_accounts_controller_spec.rb +++ b/spec/controllers/following_accounts_controller_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe FollowingAccountsController do render_views - let(:alice) { Fabricate(:account, username: 'alice') } + let(:alice) { Fabricate(:user).account } let(:followee0) { Fabricate(:account) } let(:followee1) { Fabricate(:account) } @@ -101,6 +101,23 @@ describe FollowingAccountsController do expect(body['partOf']).to be_blank end + context 'when account hides their network' do + before do + alice.user.settings.hide_network = true + end + + it 'returns followers count' do + expect(body['totalItems']).to eq 2 + end + + it 'does not return items' do + expect(body['items']).to be_blank + expect(body['orderedItems']).to be_blank + expect(body['first']).to be_blank + expect(body['last']).to be_blank + end + end + context 'when account is permanently suspended' do before do alice.suspend! diff --git a/spec/fabricators/login_activity_fabricator.rb b/spec/fabricators/login_activity_fabricator.rb new file mode 100644 index 000000000..931d3082c --- /dev/null +++ b/spec/fabricators/login_activity_fabricator.rb @@ -0,0 +1,8 @@ +Fabricator(:login_activity) do + user + strategy 'password' + success true + failure_reason nil + ip { Faker::Internet.ip_v4_address } + user_agent { Faker::Internet.user_agent } +end diff --git a/spec/models/login_activity_spec.rb b/spec/models/login_activity_spec.rb new file mode 100644 index 000000000..ba2d207c9 --- /dev/null +++ b/spec/models/login_activity_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe LoginActivity, type: :model do + +end |