# HG changeset patch # User nanaya # Date 1447567801 -32400 # Node ID 9fc6b919369c314c28aac6fdcb9059b2001416da # Parent cbfb3a0a9d2e5e151e71d3517a8ca8b6049ad47c Whoops, broken the very basic thing Added test. diff -r cbfb3a0a9d2e -r 9fc6b919369c app/models/paste.rb --- a/app/models/paste.rb Sat Nov 14 20:43:49 2015 +0900 +++ b/app/models/paste.rb Sun Nov 15 15:10:01 2015 +0900 @@ -17,7 +17,7 @@ def self.safe_find(raw_id) /\A(?[0-9]+)(?:-(?[0-9a-f]+))?\z/ =~ raw_id.to_s - where(:secret => secret, :id => id) + where(:secret => secret, :id => id).take end def self.graceful_create(params) diff -r cbfb3a0a9d2e -r 9fc6b919369c test/controllers/pastes_controller_test.rb --- a/test/controllers/pastes_controller_test.rb Sat Nov 14 20:43:49 2015 +0900 +++ b/test/controllers/pastes_controller_test.rb Sun Nov 15 15:10:01 2015 +0900 @@ -32,4 +32,10 @@ assert_response :success end + + test "shows paste" do + get :show, :id => pastes(:basic).id + + assert_response :success + end end diff -r cbfb3a0a9d2e -r 9fc6b919369c test/fixtures/pastes.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/fixtures/pastes.yml Sun Nov 15 15:10:01 2015 +0900 @@ -0,0 +1,5 @@ +basic: + paste: hello, world! + ip: 127.0.0.1 + key: 00000000 + paste_hash: 8b79c03ccb15265150cab1a7f3f61e0abb397c977fad9e51b4a0b0d8d6b9d881ac8ab33007ea6e632fda8f2c4ba0ee9ada322d6cb18be2d87948d4f9b1faf1a2