298
|
1 require "test_helper"
|
|
2
|
|
3 class PastesControllerTest < ActionController::TestCase
|
314
|
4 test "creates paste from plaintext" do
|
|
5 assert_difference("Paste.count", 1) do
|
|
6 post :create, "paste" => { "paste" => "here be paste" }
|
|
7 end
|
|
8
|
|
9 assert_response :redirect
|
|
10 end
|
|
11
|
|
12 test "creates paste from gzip" do
|
|
13 assert_difference("Paste.count", 1) do
|
|
14 post :create, "paste" => { "paste_gzip" => ActiveSupport::Gzip.compress("here be paste") }
|
|
15 end
|
|
16
|
|
17 assert_response :redirect
|
|
18 end
|
|
19
|
298
|
20 test "filters spam" do
|
|
21 assert_no_difference("Paste.count") do
|
|
22 post :create, "url1" => "http://hello.com", "paste" => { "paste" => "here be paste", "key" => "12341234" }
|
|
23 end
|
|
24
|
|
25 assert_response :success
|
|
26 end
|
|
27 end
|