闭社主体 forked from https://github.com/tootsuite/mastodon
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.

43 lines
1.1 KiB

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