twitter_spec.rb 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. require 'rails_helper'
  2. RSpec.describe 'Manage > Channels > Twitter', :use_vcr, type: :system do
  3. context 'credentials' do
  4. before { visit '/#channels/twitter' }
  5. context 'incomplete' do
  6. it 'displays a 401 error modal' do
  7. within(:active_content) do
  8. find('.js-configApp').click
  9. modal_ready
  10. fill_in 'Twitter Consumer Key *', with: 'some_key', exact: true
  11. fill_in 'Twitter Consumer Secret *', with: 'some_secret', exact: true
  12. click_on 'Submit'
  13. expect(page).to have_css('.modal .alert', text: '401 Authorization Required')
  14. end
  15. end
  16. end
  17. context 'invalid' do
  18. it 'displays a 401 error modal' do
  19. within(:active_content) do
  20. find('.js-configApp').click
  21. modal_ready
  22. fill_in 'Twitter Consumer Key *', with: 'some_key', exact: true
  23. fill_in 'Twitter Consumer Secret *', with: 'some_secret', exact: true
  24. fill_in 'Twitter Access Token *', with: 'some_oauth_token', exact: true
  25. fill_in 'Twitter Access Token Secret *', with: 'some_oauth_token_secret', exact: true
  26. fill_in 'Twitter Dev environment label *', with: 'some_env', exact: true
  27. click_on 'Submit'
  28. expect(page).to have_css('.modal .alert', text: '401 Authorization Required')
  29. end
  30. end
  31. end
  32. end
  33. end