Mercurial > zeropaste
comparison test/controllers/pastes_controller_test.rb @ 499:d2ef59c9a4b4
Use rails rubocop
author | nanaya <me@nanaya.net> |
---|---|
date | Sun, 15 Dec 2024 22:33:27 +0900 |
parents | 84ca55a0568e |
children |
comparison
equal
deleted
inserted
replaced
498:300bac944674 | 499:d2ef59c9a4b4 |
---|---|
1 require "test_helper" | 1 require "test_helper" |
2 | 2 |
3 class PastesControllerTest < ActionController::TestCase | 3 class PastesControllerTest < ActionController::TestCase |
4 test "creates paste from plaintext" do | 4 test "creates paste from plaintext" do |
5 assert_difference("Paste.count", 1) do | 5 assert_difference("Paste.count", 1) do |
6 post :create, :params => { "paste" => { "paste" => "here be paste" } } | 6 post :create, params: { "paste" => { "paste" => "here be paste" } } |
7 end | 7 end |
8 | 8 |
9 assert_response :redirect | 9 assert_response :redirect |
10 end | 10 end |
11 | 11 |
12 test "creates paste from gzip" do | 12 test "creates paste from gzip" do |
13 assert_difference("Paste.count", 1) do | 13 assert_difference("Paste.count", 1) do |
14 post :create, :params => { "paste" => { "paste_gzip" => fixture_file_upload('hello_world.txt.gz') } } | 14 post :create, params: { "paste" => { "paste_gzip" => fixture_file_upload("hello_world.txt.gz") } } |
15 end | 15 end |
16 | 16 |
17 assert_response :redirect | 17 assert_response :redirect |
18 end | 18 end |
19 | 19 |
20 test "creates paste from base64 gzip" do | 20 test "creates paste from base64 gzip" do |
21 assert_difference("Paste.count", 1) do | 21 assert_difference("Paste.count", 1) do |
22 post :create, :params => { "paste" => { "paste_gzip_base64" => Base64.encode64(ActiveSupport::Gzip.compress("here be paste")) } } | 22 post :create, params: { "paste" => { "paste_gzip_base64" => Base64.encode64(ActiveSupport::Gzip.compress("here be paste")) } } |
23 end | 23 end |
24 | 24 |
25 assert_response :redirect | 25 assert_response :redirect |
26 end | 26 end |
27 | 27 |
28 test "filters spam" do | 28 test "filters spam" do |
29 assert_no_difference("Paste.count") do | 29 assert_no_difference("Paste.count") do |
30 post :create, :params => { "url1" => "http://hello.com", "paste" => { "paste" => "here be paste", "key" => "12341234" } } | 30 post :create, params: { "url1" => "http://hello.com", "paste" => { "paste" => "here be paste", "key" => "12341234" } } |
31 end | 31 end |
32 | 32 |
33 assert_response :success | 33 assert_response :success |
34 end | 34 end |
35 | 35 |
36 test "shows paste" do | 36 test "shows paste" do |
37 get :show, :params => { :id => pastes(:basic).id } | 37 get :show, params: { id: pastes(:basic).id } |
38 | 38 |
39 assert_response :success | 39 assert_response :success |
40 end | 40 end |
41 end | 41 end |