Skip to content

Business intelligence made simple

Added more tests for uploads [skip ci]

Andrew Kane259c99633e9b
diff --git a/test/uploads_test.rb b/test/uploads_test.rb
index 50ab3ac6..ef32f5b4 100644
--- a/test/uploads_test.rb
+++ b/test/uploads_test.rb
@@ -50,7 +50,23 @@ class UploadsTest < ActionDispatch::IntegrationTest
assert_match "Table already exists", response.body
end
- def test_rename
+ def test_show
+ create_upload
+ upload = Blazer::Upload.last
+
+ get blazer.upload_path(upload)
+ assert_redirected_to blazer.new_query_path(upload_id: upload.id)
+ end
+
+ def test_edit
+ create_upload
+ upload = Blazer::Upload.last
+
+ get blazer.edit_upload_path(upload)
+ assert_response :success
+ end
+
+ def test_update_rename
create_upload
upload = Blazer::Upload.last
assert_redirected_to blazer.upload_path(upload)
@@ -62,6 +78,18 @@ class UploadsTest < ActionDispatch::IntegrationTest
assert_equal ["items"], tables
end
+ def test_destroy
+ create_upload
+ upload = Blazer::Upload.last
+
+ delete blazer.upload_path(upload)
+ assert_redirected_to blazer.uploads_path
+
+ assert_raises(ActiveRecord::RecordNotFound) do
+ upload.reload
+ end
+ end
+
def test_bad_content_type
create_upload(content_type: "text/plain")
assert_response :unprocessable_entity