changeset 314:3c22d4acc2fa

Add basic controller test.
author edogawaconan <me@myconan.net>
date Sat, 05 Apr 2014 23:08:49 +0900
parents cc4171e52bb3
children 325fcf388442
files test/controllers/pastes_controller_test.rb
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/controllers/pastes_controller_test.rb	Sat Apr 05 22:51:18 2014 +0900
+++ b/test/controllers/pastes_controller_test.rb	Sat Apr 05 23:08:49 2014 +0900
@@ -1,6 +1,22 @@
 require "test_helper"
 
 class PastesControllerTest < ActionController::TestCase
+  test "creates paste from plaintext" do
+    assert_difference("Paste.count", 1) do
+      post :create, "paste" => { "paste" => "here be paste" }
+    end
+
+    assert_response :redirect
+  end
+
+  test "creates paste from gzip" do
+    assert_difference("Paste.count", 1) do
+      post :create, "paste" => { "paste_gzip" => ActiveSupport::Gzip.compress("here be paste") }
+    end
+
+    assert_response :redirect
+  end
+
   test "filters spam" do
     assert_no_difference("Paste.count") do
       post :create, "url1" => "http://hello.com", "paste" => { "paste" => "here be paste", "key" => "12341234" }