File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ require 'test_helper'
2+
3+ class DocMethodsControllerTest < ActionController ::TestCase
4+ include Devise ::Test ::ControllerHelpers
5+
6+ setup do
7+ sign_in users ( :schneems )
8+ @user = users ( :schneems )
9+ @triage_doc = doc_methods ( :issue_triage_doc )
10+ @repo_sub = RepoSubscription . where ( user_id : @user . id , repo : @triage_doc . repo ) . first
11+ end
12+
13+ test 'click_method_redirect with a DocAssignment redirects to the doc_method url' do
14+ DocAssignment . create ( doc_method_id : @triage_doc . id , repo_subscription_id : @repo_sub . id )
15+
16+ get :click_method_redirect , params : { id : @triage_doc . id , user_id : @user . id }
17+
18+ assert_redirected_to doc_method_url ( @triage_doc )
19+ end
20+
21+ test 'click_method_redirect without any DocAssignment returns to root an displays an error' do
22+ get :click_method_redirect , params : { id : @triage_doc . id , user_id : @user . id }
23+
24+ assert flash [ :notice ] . eql? "Bad url, if this problem persists please open an issue github.com/codetriage/codetriage"
25+ assert_redirected_to :root
26+ end
27+ end
You can’t perform that action at this time.
0 commit comments