summaryrefslogtreecommitdiff
path: root/test/controllers/topics/moves_controller_test.rb
blob: 3f9c2068ed64c21223fbfc4bffaa07d27a7d1dd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

require 'test_helper'

class Topics::MovesControllerTest < ActionController::TestCase
  setup do
    @target_forum = create(:forum_with_topics)
    @user = create(:moderator)
    @topic = create(:topic)
    @forum = @topic.forum
  end

  test 'can be moved' do
    sign_in @user

    post :create, params: { topic_id: @topic, forum_id: @forum, target_forum_id: @target_forum }

    @topic.reload
    assert_response :redirect
    assert_redirected_to forum_topic_path(@target_forum, @topic)
  end
end