trabajo-afectivo/spec/system/channels/twitter_spec.rb

45 lines
1.5 KiB
Ruby
Raw Permalink Normal View History

2022-01-01 13:38:12 +00:00
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
require 'rails_helper'
RSpec.describe 'Manage > Channels > Twitter', :use_vcr, type: :system do
context 'credentials' do
before { visit '/#channels/twitter' }
context 'incomplete' do
it 'displays a 401 error modal' do
within(:active_content) do
find('.js-configApp').click
modal_ready
fill_in 'Twitter Consumer Key *', with: 'some_key', exact: true
fill_in 'Twitter Consumer Secret *', with: 'some_secret', exact: true
click_on 'Submit'
expect(page).to have_css('.modal .alert', text: '401 Unauthorized (Invalid credentials may be to blame.)')
end
end
end
context 'invalid' do
it 'displays a 401 error modal' do
within(:active_content) do
find('.js-configApp').click
modal_ready
fill_in 'Twitter Consumer Key *', with: 'some_key', exact: true
fill_in 'Twitter Consumer Secret *', with: 'some_secret', exact: true
fill_in 'Twitter Access Token *', with: 'some_oauth_token', exact: true
fill_in 'Twitter Access Token Secret *', with: 'some_oauth_token_secret', exact: true
fill_in 'Twitter Dev environment label *', with: 'some_env', exact: true
click_on 'Submit'
expect(page).to have_css('.modal .alert', text: '401 Unauthorized (Invalid credentials may be to blame.)')
end
end
end
end
end