diff --git a/README.md b/README.md index 4f96c6b..e47325b 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Run the tests locally (against development environment): ## TODOs +1. Consolidate routes 1. Implement flag post button 1. Implement [bcrypt](https://metacpan.org/pod/Mojolicious::Plugin::BcryptSecure) diff --git a/lib/PostText.pm b/lib/PostText.pm index 9d45f6b..1d35021 100644 --- a/lib/PostText.pm +++ b/lib/PostText.pm @@ -78,6 +78,11 @@ sub startup($self) { ->to('thread#by_id') ->name('single_thread'); + my $bump_thread = $r->under('/bump'); + $bump_thread->get('/:thread_id', [thread_id => qr/[0-9]+/]) + ->to('thread#bump') + ->name('bump_thread'); + # Remark my $post_remark = $r->under('/post'); $post_remark @@ -89,12 +94,6 @@ sub startup($self) { $single_remark->get('/:remark_id', [remark_id => qr/[0-9]+/]) ->to('remark#by_id') ->name('single_remark'); - - # Bump - my $bump_thread = $r->under('/bump'); - $bump_thread->get('/:thread_id', [thread_id => qr/[0-9]+/]) - ->to('thread#bump') - ->name('bump_thread'); } 1; diff --git a/t/.#remark.t b/t/.#remark.t new file mode 120000 index 0000000..63494f2 --- /dev/null +++ b/t/.#remark.t @@ -0,0 +1 @@ +daniel@graymember.98268 \ No newline at end of file diff --git a/t/remark.t b/t/remark.t index f7e7a7f..96659e9 100644 --- a/t/remark.t +++ b/t/remark.t @@ -17,6 +17,12 @@ subtest 'View single remark', sub { $t->get_ok('/remark/1')->status_is(200)->text_like(h2 => qr/Remark #1/); }; +subtest 'Flagging remark', sub { + $t->get_ok('/remark/1')->status_is(200) + ->element_exists('a[href*="flag"]') + ->text_like(h2 => qr/Thread #1/); +} + $t->ua->max_redirects(1); subtest 'Post new remark', sub { diff --git a/t/thread.t b/t/thread.t index 41f267a..a7f9774 100644 --- a/t/thread.t +++ b/t/thread.t @@ -67,4 +67,14 @@ subtest 'Bumping thread', sub { ->text_like(p => qr/Thread #[0-9]+ has been bumped/); }; +subtest 'Flagging thread', sub { + $t->get_ok('/list')->status_is(200) + ->element_exists('a[href*="flag"]') + ->text_like(h2 => qr/Threads List/); + + $t->get_ok('/thread/1')->status_is(200) + ->element_exists('a[href*="flag"]') + ->text_like(h2 => qr/Thread #1/); +} + done_testing();