diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-07-08 16:17:19 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2021-07-08 16:17:19 +0200 |
commit | 3160e050a95afe47317e82956f055a5ab6030698 (patch) | |
tree | 957699d2b99e6d0024560d790a011a30e60ddd3b /spec/models | |
parent | 0c2eb949fc21ceecbd99a81e5ffe75517a1e64df (diff) | |
parent | c4568e3b606cc4007739f881c334bdfe8dc77745 (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `app/helpers/accounts_helper.rb`: Conflict due to upstream changing how followers count is displayed while we have an option to hide followers count. Ported upstream change. - `app/views/accounts/_header.html.haml`: Conflict due to upstream changing how followers count is displayed while we have an option to hide followers count. Ported upstream change. - `app/views/directories/index.html.haml`: Conflict due to upstream changing how followers count is displayed while we have an option to hide followers count. Ported upstream change.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/tag_feed_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 28 |
2 files changed, 29 insertions, 1 deletions
diff --git a/spec/models/tag_feed_spec.rb b/spec/models/tag_feed_spec.rb index 76277c467..45f7c3329 100644 --- a/spec/models/tag_feed_spec.rb +++ b/spec/models/tag_feed_spec.rb @@ -37,7 +37,7 @@ describe TagFeed, type: :service do expect(results).to include both end - it 'handles being passed non existant tag names' do + it 'handles being passed non existent tag names' do results = described_class.new(tag1, nil, any: ['wark']).get(20) expect(results).to include status1 expect(results).to_not include status2 diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 5db249be2..54bb6db7f 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -344,6 +344,34 @@ RSpec.describe User, type: :model do end end + describe '#reset_password!' do + subject(:user) { Fabricate(:user, password: 'foobar12345') } + + let!(:session_activation) { Fabricate(:session_activation, user: user) } + let!(:access_token) { Fabricate(:access_token, resource_owner_id: user.id) } + let!(:web_push_subscription) { Fabricate(:web_push_subscription, access_token: access_token) } + + before do + user.reset_password! + end + + it 'changes the password immediately' do + expect(user.external_or_valid_password?('foobar12345')).to be false + end + + it 'deactivates all sessions' do + expect(user.session_activations.count).to eq 0 + end + + it 'revokes all access tokens' do + expect(Doorkeeper::AccessToken.active_for(user).count).to eq 0 + end + + it 'removes push subscriptions' do + expect(Web::PushSubscription.where(user: user).or(Web::PushSubscription.where(access_token: access_token)).count).to eq 0 + end + end + describe '#confirm!' do subject(:user) { Fabricate(:user, confirmed_at: confirmed_at) } |