Business intelligence made simple
Improved redirect tests
Andrew Kaned9be13798af5
diff --git a/test/checks_test.rb b/test/checks_test.rbindex 1019a3c8..bd293c5f 100644--- a/test/checks_test.rb+++ b/test/checks_test.rb@@ -35,7 +35,7 @@ class ChecksTest < ActionDispatch::IntegrationTestquery = create_querypost blazer.checks_path(params: {check: {query_id: query.id, schedule: "5 minutes", check_type: "bad_data", emails: "[email protected]"}})- assert_response :redirect+ assert_redirected_to blazer.query_path(query)enddef test_edit@@ -51,7 +51,7 @@ class ChecksTest < ActionDispatch::IntegrationTestcheck = create_check(query: query, check_type: "bad_data")patch blazer.check_path(check, params: {check: {schedule: "1 hour"}})- assert_response :redirect+ assert_redirected_to blazer.query_path(query)check.reloadassert_equal "1 hour", check.schedule@@ -62,7 +62,7 @@ class ChecksTest < ActionDispatch::IntegrationTestcheck = create_check(query: query, check_type: "bad_data")delete blazer.check_path(check)- assert_response :redirect+ assert_redirected_to blazer.checks_pathassert_raises(ActiveRecord::RecordNotFound) docheck.reload@@ -74,7 +74,7 @@ class ChecksTest < ActionDispatch::IntegrationTestcheck = create_check(query: query, check_type: "bad_data")get blazer.run_check_path(check)- assert_response :redirect+ assert_redirected_to blazer.query_path(query)enddef test_bad_datadiff --git a/test/dashboards_test.rb b/test/dashboards_test.rbindex 426de4cf..200be165 100644--- a/test/dashboards_test.rb+++ b/test/dashboards_test.rb@@ -20,14 +20,14 @@ class DashboardsTest < ActionDispatch::IntegrationTestdef test_destroydashboard = create_dashboarddelete blazer.dashboard_path(dashboard)- assert_response :redirect+ assert_redirected_to blazer.root_pathenddef test_refreshdashboard = create_dashboarddashboard.queries << create_querypost blazer.refresh_dashboard_path(dashboard)- assert_response :redirect+ assert_redirected_to blazer.dashboard_path(dashboard)enddef create_dashboarddiff --git a/test/permissions_test.rb b/test/permissions_test.rbindex d1f34ff7..2bd0738f 100644--- a/test/permissions_test.rb+++ b/test/permissions_test.rb@@ -34,7 +34,7 @@ class PermissionsTest < ActionDispatch::IntegrationTestdelete blazer.query_path(query)# TODO error response- assert_response :redirect+ assert_redirected_to blazer.root_pathassert Blazer::Query.exists?(query.id)endend@@ -44,10 +44,10 @@ class PermissionsTest < ActionDispatch::IntegrationTestquery = create_query(name: "Test", creator: user)patch blazer.query_path(query), params: {query: {name: "* Test"}}- assert_response :redirect+ assert_redirected_to blazer.query_path(query)patch blazer.query_path(query), params: {query: {name: "# Test"}}- assert_response :redirect+ assert_redirected_to blazer.query_path(query)endenddiff --git a/test/queries_test.rb b/test/queries_test.rbindex 1a5a31b9..52be2a43 100644--- a/test/queries_test.rb+++ b/test/queries_test.rb@@ -13,9 +13,9 @@ class QueriesTest < ActionDispatch::IntegrationTestdef test_createpost blazer.queries_path, params: {query: {name: "Test", statement: "SELECT 1", data_source: "main"}}- assert_response :redirect-query = Blazer::Query.last+ assert_redirected_to blazer.query_path(query)+get blazer.query_path(query)assert_response :success@@ -36,7 +36,7 @@ class QueriesTest < ActionDispatch::IntegrationTestdef test_destroyquery = create_querydelete blazer.query_path(query)- assert_response :redirect+ assert_redirected_to blazer.root_pathenddef test_rollback@@ -66,7 +66,7 @@ class QueriesTest < ActionDispatch::IntegrationTestdef test_refreshquery = create_querypost blazer.refresh_query_path(query)- assert_response :redirect+ assert_redirected_to blazer.query_path(query)enddef test_variables_timediff --git a/test/uploads_test.rb b/test/uploads_test.rbindex 50c5a6e5..50ab3ac6 100644--- a/test/uploads_test.rb+++ b/test/uploads_test.rb@@ -21,9 +21,9 @@ class UploadsTest < ActionDispatch::IntegrationTestdef test_createcreate_upload- assert_response :redirect-upload = Blazer::Upload.last+ assert_redirected_to blazer.upload_path(upload)+assert_equal "line_items", upload.tableassert_equal "Billing line items", upload.description@@ -41,7 +41,8 @@ class UploadsTest < ActionDispatch::IntegrationTestdef test_create_duplicate_tablecreate_upload- assert_response :redirect+ upload = Blazer::Upload.last+ assert_redirected_to blazer.upload_path(upload)Blazer::Upload.delete_allcreate_upload@@ -51,11 +52,11 @@ class UploadsTest < ActionDispatch::IntegrationTestdef test_renamecreate_upload- assert_response :redirect-upload = Blazer::Upload.last+ assert_redirected_to blazer.upload_path(upload)+patch blazer.upload_path(upload), params: {upload: {table: "items"}}- assert_response :redirect+ assert_redirected_to blazer.upload_path(upload)tables = Blazer::UploadsConnection.connection.select_all("SELECT table_name FROM information_schema.tables WHERE table_schema = 'uploads'").rows.map(&:first)assert_equal ["items"], tables