You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.1 KiB

  1. require 'rails_helper'
  2. RSpec.describe Settings::ImportsController, type: :controller do
  3. render_views
  4. before do
  5. sign_in Fabricate(:user), scope: :user
  6. end
  7. describe "GET #show" do
  8. it "returns http success" do
  9. get :show
  10. expect(response).to have_http_status(:success)
  11. end
  12. end
  13. describe 'POST #create' do
  14. it 'redirects to settings path with successful following import' do
  15. service = double(call: nil)
  16. allow(ResolveRemoteAccountService).to receive(:new).and_return(service)
  17. post :create, params: {
  18. import: {
  19. type: 'following',
  20. data: fixture_file_upload('files/imports.txt')
  21. }
  22. }
  23. expect(response).to redirect_to(settings_import_path)
  24. end
  25. it 'redirects to settings path with successful blocking import' do
  26. service = double(call: nil)
  27. allow(ResolveRemoteAccountService).to receive(:new).and_return(service)
  28. post :create, params: {
  29. import: {
  30. type: 'blocking',
  31. data: fixture_file_upload('files/imports.txt')
  32. }
  33. }
  34. expect(response).to redirect_to(settings_import_path)
  35. end
  36. end
  37. end