annotate test/controllers/pastes_controller_test.rb @ 334:41b0903c9b2b

Use official bootstrap gem.
author edogawaconan <me@myconan.net>
date Wed, 23 Apr 2014 09:24:05 +0900
parents 325fcf388442
children 9fc6b919369c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
298
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
1 require "test_helper"
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
2
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
3 class PastesControllerTest < ActionController::TestCase
314
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
4 test "creates paste from plaintext" do
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
5 assert_difference("Paste.count", 1) do
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
6 post :create, "paste" => { "paste" => "here be paste" }
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
7 end
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
8
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
9 assert_response :redirect
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
10 end
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
11
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
12 test "creates paste from gzip" do
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
13 assert_difference("Paste.count", 1) do
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
14 post :create, "paste" => { "paste_gzip" => ActiveSupport::Gzip.compress("here be paste") }
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
15 end
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
16
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
17 assert_response :redirect
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
18 end
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
19
315
325fcf388442 Another test for paste creation.
edogawaconan <me@myconan.net>
parents: 314
diff changeset
20 test "creates paste from base64 gzip" do
325fcf388442 Another test for paste creation.
edogawaconan <me@myconan.net>
parents: 314
diff changeset
21 assert_difference("Paste.count", 1) do
325fcf388442 Another test for paste creation.
edogawaconan <me@myconan.net>
parents: 314
diff changeset
22 post :create, "paste" => { "paste_gzip_base64" => Base64.encode64(ActiveSupport::Gzip.compress("here be paste")) }
325fcf388442 Another test for paste creation.
edogawaconan <me@myconan.net>
parents: 314
diff changeset
23 end
325fcf388442 Another test for paste creation.
edogawaconan <me@myconan.net>
parents: 314
diff changeset
24
325fcf388442 Another test for paste creation.
edogawaconan <me@myconan.net>
parents: 314
diff changeset
25 assert_response :redirect
325fcf388442 Another test for paste creation.
edogawaconan <me@myconan.net>
parents: 314
diff changeset
26 end
325fcf388442 Another test for paste creation.
edogawaconan <me@myconan.net>
parents: 314
diff changeset
27
298
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
28 test "filters spam" do
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
29 assert_no_difference("Paste.count") do
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
30 post :create, "url1" => "http://hello.com", "paste" => { "paste" => "here be paste", "key" => "12341234" }
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
31 end
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
32
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
33 assert_response :success
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
34 end
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
35 end