diff --git a/test/functional/answers_controller_test.rb b/test/functional/answers_controller_test.rb index d375215..852504c 100644 --- a/test/functional/answers_controller_test.rb +++ b/test/functional/answers_controller_test.rb @@ -43,7 +43,8 @@ form_attributes = {"answer-text-#{question.id}": "Tested", answer: {user_id: answer.user.id, plan_id: answer.plan.id, - question_id: answer.question.id}} + question_id: answer.question.id, + lock_version: answer.lock_version}} put_answer(answer, form_attributes, referrer) @@ -59,15 +60,12 @@ private def put_answer(answer, attributes, referrer) - put answer_path(FastGettext.locale, answer), attributes, {'HTTP_REFERER': referrer, 'ACCEPT': 'text/javascript'} + put answer_path(FastGettext.locale, answer, format: "js"), attributes, {'HTTP_REFERER': referrer} - assert_equal _('Answer was successfully recorded.'), flash[:notice] - assert_response :redirect - - follow_redirects - assert_response :success - assert_select '.main_page_content h1', _('My plans') - + assert_equal "text/javascript", @response.content_type + + # last line of JS updates section status with X questions, Y answered + assert_match /status"\).html\("\([0-9]+ questions, [0-9]+ answered/, @response.body end -end \ No newline at end of file +end