summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/features/secure_oauth_authorizations_shared_examples.rb
blob: 028e075c87a9af1bbe39d7d7ff9494774ff4146f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

RSpec.shared_examples 'Secure OAuth Authorizations' do
  context 'when user is confirmed' do
    let(:user) { create(:user) }

    it 'asks the user to authorize the application' do
      expect(page).to have_text "Authorize #{application.name} to use your account?"
    end
  end

  context 'when user is unconfirmed' do
    let(:user) { create(:user, confirmed_at: nil) }

    it 'displays an error' do
      expect(page).to have_text I18n.t('doorkeeper.errors.messages.unconfirmed_email')
    end
  end
end