comparison test/controllers/pastes_controller_test.rb @ 435:1d113463d154

Fix test deprecations
author nanaya <me@myconan.net>
date Fri, 13 May 2016 04:04:29 +0900
parents 9fc6b919369c
children 84ca55a0568e
comparison
equal deleted inserted replaced
434:b2991317d4d7 435:1d113463d154
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, "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, "paste" => { "paste_gzip" => ActiveSupport::Gzip.compress("here be paste") } 14 post :create, :params => { "paste" => { "paste_gzip" => ActiveSupport::Gzip.compress("here be paste") } }
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, "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, "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, :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