Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Add PagesControllerTest with authentication (#288)

Dwight Watsonfb7411e16301
diff --git a/test/controllers/pages_controller_test.rb b/test/controllers/pages_controller_test.rb
new file mode 100644
index 00000000..5083248e
--- /dev/null
+++ b/test/controllers/pages_controller_test.rb
@@ -0,0 +1,12 @@
+require "test_helper"
+
+class PagesControllerTest < ActionDispatch::IntegrationTest
+ setup do
+ sign_in users(:bob)
+ end
+
+ test "dashboard" do
+ get root_path
+ assert_response :ok
+ end
+end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 0c22470e..118dc97e 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -11,5 +11,8 @@ module ActiveSupport
fixtures :all
# Add more helper methods to be used by all tests here...
+ def sign_in(user)
+ post session_path, params: { email: user.email, password: "password" }
+ end
end
end