Mercurial > zeropaste
view test/controllers/pastes_controller_test.rb @ 506:b5c6fd96100b default tip
Readd the field error proc config
author | nanaya <me@nanaya.net> |
---|---|
date | Mon, 16 Dec 2024 01:46:09 +0900 |
parents | d2ef59c9a4b4 |
children |
line wrap: on
line source
require "test_helper" class PastesControllerTest < ActionController::TestCase test "creates paste from plaintext" do assert_difference("Paste.count", 1) do post :create, params: { "paste" => { "paste" => "here be paste" } } end assert_response :redirect end test "creates paste from gzip" do assert_difference("Paste.count", 1) do post :create, params: { "paste" => { "paste_gzip" => fixture_file_upload("hello_world.txt.gz") } } end assert_response :redirect end test "creates paste from base64 gzip" do assert_difference("Paste.count", 1) do post :create, params: { "paste" => { "paste_gzip_base64" => Base64.encode64(ActiveSupport::Gzip.compress("here be paste")) } } end assert_response :redirect end test "filters spam" do assert_no_difference("Paste.count") do post :create, params: { "url1" => "http://hello.com", "paste" => { "paste" => "here be paste", "key" => "12341234" } } end assert_response :success end test "shows paste" do get :show, params: { id: pastes(:basic).id } assert_response :success end end