File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed
Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change 44
55RSpec . describe 'POST /request_for_comments/:rfc_id/report' , type : :request do
66 before do
7+ login_as ( create ( :learner ) )
78 codeocean_config = instance_double ( CodeOcean ::Config )
89 allow ( CodeOcean ::Config ) . to receive ( :new ) . with ( :code_ocean ) . and_return ( codeocean_config )
910 allow ( codeocean_config ) . to receive ( :read ) . and_return ( {
1213 end
1314
1415 it 'sends an email to let admins know about the report' do
15- user = create ( :learner )
16- password = attributes_for ( :learner ) . fetch ( :password )
17- login_as ( user , password )
1816 rfc = create ( :rfc )
1917
2018 expect { post ( report_request_for_comment_path ( rfc ) ) }
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ def sign_in(user, password)
77end
88
99module RequestLoginHelper
10- def login_as ( user , password )
11- post ( sessions_url , params : { email : user . email , password : } )
10+ def login_as ( user )
11+ allow_any_instance_of ( ApplicationController ) . to receive ( :current_user ) . and_return ( user )
1212 end
1313end
1414
You can’t perform that action at this time.
0 commit comments