Permalink
Browse files

added test and fix for title changing, test not passing

  • Loading branch information...
1 parent 15d6afb commit 995ee440e02417e03793f98827cf916a7329706a Devin Austin committed with Feb 22, 2012
Showing with 10 additions and 4 deletions.
  1. +4 −2 lib/Grimlock/Web/Controller/Entry.pm
  2. +6 −2 t/controller_Entry.t
@@ -24,7 +24,7 @@ sub load_entry : Chained('base') PathPart('') CaptureArgs(1) {
my ( $self, $c, $entry_title ) = @_;
my $entry = $c->model('Database::Entry')->find(
{
- display_title => $entry_title
+ display_title => $entry_title,
},
{
prefetch => 'children'
@@ -152,8 +152,10 @@ sub browse_GET {
sub browse_PUT {
my ( $self, $c ) = @_;
- my $entry = $c->stash->{'entry'};
my $params ||= $c->req->data || $c->req->params;
+ use Data::Dumper;
+ $c->log->debug("PARAMS " . Dumper $params);
+ my $entry = $c->stash->{'entry'} ? $c->stash->{'entry'} : $c->user->entries->find($params->{'entryid'});
$params->{'published'} = $params->{'published'} eq 'on' ? 1 : 0;
delete $params->{$_} for qw( frmInsertFlag frmRecord );
$entry->update($params) || return $self->status_bad_request($c,
View
@@ -1,7 +1,7 @@
use strict;
use warnings;
use Test::More;
-use HTTP::Request::Common qw(DELETE);
+use HTTP::Request::Common qw(DELETE PUT);
use Test::WWW::Mechanize::PSGI;
use FindBin qw( $Bin );
use lib "$Bin/../t/lib";
@@ -79,7 +79,11 @@ $mech->post('/test-title-with-spaces-/reply',
ok $mech->success, "reply post works ok";
+$mech->request( PUT '/test-title-with-spaces-',
+ Content => 'title=huehuehue'
+);
+ok $mech->success, "changing title works ok";
$mech->request( DELETE '/test-title-with-spaces-' );
-ok $mech->success, "draft deletion works";
+ok $mech->success, "entry deletion works";
done_testing();

0 comments on commit 995ee44

Please sign in to comment.