diff --git a/Gemfile b/Gemfile
index e89e6ca..651faee 100644
--- a/Gemfile
+++ b/Gemfile
@@ -39,6 +39,7 @@ group :development, :test do
gem 'minitest-reporters'
gem 'pry-byebug'
gem 'pry-rails'
+ gem 'rails-controller-testing'
gem 'rubocop', '~> 0.42.0'
gem 'simplecov', require: false
gem 'spring'
diff --git a/Gemfile.lock b/Gemfile.lock
index 1ff2d1b..a704484 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -178,6 +178,10 @@ GEM
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.0)
sprockets-rails (>= 2.0.0)
+ rails-controller-testing (1.0.1)
+ actionpack (~> 5.x)
+ actionview (~> 5.x)
+ activesupport (~> 5.x)
rails-dom-testing (2.0.1)
activesupport (>= 4.2.0, < 6.0)
nokogiri (~> 1.6.0)
@@ -290,6 +294,7 @@ DEPENDENCIES
puma (~> 3.0)
rack-livereload
rails (~> 5.0.0)
+ rails-controller-testing
rails-erd
rubocop (~> 0.42.0)
sass-rails (~> 5.0)
diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb
deleted file mode 100644
index 9ba1d7e..0000000
--- a/app/views/layouts/_footer.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index a66a0f9..9e37c00 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -42,7 +42,12 @@
<% end %>
- <%= render partial: 'layouts/footer' %>
+
+
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
diff --git a/test/controllers/quiz_controller_test.rb b/test/controllers/quiz_controller_test.rb
index 8de42eb..de17520 100644
--- a/test/controllers/quiz_controller_test.rb
+++ b/test/controllers/quiz_controller_test.rb
@@ -38,6 +38,24 @@ class QuizControllerTest < ActionDispatch::IntegrationTest
assert_redirected_to question_path
assert session[:test_id].present?
+ assert assigns(:question), '@question not present'
+ assert assigns(:answer), '@answer not present'
+ assert assigns(:status), '@status not present'
+ end
+
+ test "should get summary" do
+ setup_auth candidates :dawn
+ get summary_path
+
+ assert_response :success
+ assert assigns(:quiz), '@quiz not present'
+ end
+
+ test "should redirect from summary" do
+ setup_auth candidates :roy
+ get summary_path
+
+ assert_redirected_to question_path
end
test "should get flash message on bad radio response" do
@@ -48,6 +66,8 @@ class QuizControllerTest < ActionDispatch::IntegrationTest
assert_response :success
assert session[:test_id].present?
assert_equal qid, flash[:error]
+ assert assigns(:question), '@question not present'
+ assert assigns(:answer), '@answer not present'
end
test "should get flash message on bad text response" do
@@ -58,6 +78,8 @@ class QuizControllerTest < ActionDispatch::IntegrationTest
assert_response :success
assert session[:test_id].present?
assert_equal qid, flash[:error]
+ assert assigns(:question), '@question not present'
+ assert assigns(:answer), '@answer not present'
end
test "should process checkbox" do
@@ -67,6 +89,8 @@ class QuizControllerTest < ActionDispatch::IntegrationTest
assert_response :success
assert session[:test_id].present?
+ assert assigns(:question), '@question not present'
+ assert assigns(:answer), '@answer not present'
end
test 'should handle XHR update and complete progress' do
@@ -77,6 +101,8 @@ class QuizControllerTest < ActionDispatch::IntegrationTest
assert_response :success
assert_match(/updated successfully/, JSON.parse(@response.body)['message'])
assert_equal 100, JSON.parse(@response.body)['progress']
+ assert assigns(:question), '@question not present'
+ assert assigns(:answer), '@answer not present'
end
test 'should handle XHR fail' do
@@ -86,5 +112,7 @@ class QuizControllerTest < ActionDispatch::IntegrationTest
assert_response 400
assert_match(/select.*answer/i, JSON.parse(@response.body).join)
+ assert assigns(:question), '@question not present'
+ assert assigns(:answer), '@answer not present'
end
end
diff --git a/test/controllers/recruiter_controller_test.rb b/test/controllers/recruiter_controller_test.rb
index 5a02765..d63c300 100644
--- a/test/controllers/recruiter_controller_test.rb
+++ b/test/controllers/recruiter_controller_test.rb
@@ -48,12 +48,14 @@ class RecruiterControllerTest < ActionDispatch::IntegrationTest
setup_auth
get recruiter_url
assert_response :success
+ assert assigns(:candidates), "@candidates not present"
end
test "should get new" do
setup_auth
get new_candidate_url
assert_response :success
+ assert assigns(:candidate), "@candidate not present"
end
test "should get create" do
@@ -85,6 +87,7 @@ class RecruiterControllerTest < ActionDispatch::IntegrationTest
end
end
assert :success
+ assert assigns(:candidate), "@candidate not present"
assert_match(/failed.*save/i, flash[:error])
end
end
diff --git a/test/controllers/review_controller_test.rb b/test/controllers/review_controller_test.rb
index 12e92f3..b030c41 100644
--- a/test/controllers/review_controller_test.rb
+++ b/test/controllers/review_controller_test.rb
@@ -37,6 +37,7 @@ class ReviewControllerTest < ActionDispatch::IntegrationTest
setup_auth
get review_url
assert_response :success
+ assert assigns(:candidates), '@candidates not present'
end
test "should get index" do
@@ -51,6 +52,9 @@ class ReviewControllerTest < ActionDispatch::IntegrationTest
get review_test_url(candidates(:richard).test_hash)
assert_response :success
+ assert assigns(:candidate), "@candidate not present"
+ assert assigns(:quiz), "@quiz not present"
+ assert assigns(:status), "@status not present"
end
test 'should logout and reset session' do