Skip to content

Commit

Permalink
Use RFC 6901 compliant JSON pointers in tests, 0.027 release
Browse files Browse the repository at this point in the history
  • Loading branch information
jberger committed Apr 3, 2013
1 parent 7f9f25f commit 6bda6a9
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Build.PL
Expand Up @@ -11,7 +11,7 @@ my $builder = Module::Build->new(

requires => {
'perl' => '5.10.1',
'Mojolicious' => '3.85', # ->post_ok( ... => form => {} )
'Mojolicious' => '3.92', # RFC 6901 compliant json pointers in tests
'Mojolicious::Plugin::Humane' => '0.04',
'DBD::SQLite' => 0,
'DBIx::Class' => 0,
Expand Down
4 changes: 4 additions & 0 deletions Changes
@@ -1,5 +1,9 @@
Revision history for Perl module Galileo.

0.027 April 3, 2013
- Use RFC 6901 compliant JSON pointers in tests
- Bump Mojolicious to 3.92

0.026 March 15, 2013
- Added File::Next to requires, was causing failing installation

Expand Down
6 changes: 3 additions & 3 deletions META.json
Expand Up @@ -35,7 +35,7 @@
"File::Copy::Recursive" : "0",
"File::Next" : "0",
"File::ShareDir" : "1.00",
"Mojolicious" : "3.85",
"Mojolicious" : "3.92",
"Mojolicious::Plugin::Humane" : "0.04",
"SQL::Translator" : "0",
"Term::Prompt" : "0",
Expand All @@ -46,7 +46,7 @@
"provides" : {
"Galileo" : {
"file" : "lib/Galileo.pm",
"version" : "0.026"
"version" : "0.027"
},
"Galileo::Admin" : {
"file" : "lib/Galileo/Admin.pm",
Expand Down Expand Up @@ -109,5 +109,5 @@
"url" : "http://github.com/jberger/Galileo"
}
},
"version" : "0.026"
"version" : "0.027"
}
6 changes: 3 additions & 3 deletions META.yml
Expand Up @@ -18,7 +18,7 @@ no_index:
provides:
Galileo:
file: lib/Galileo.pm
version: 0.026
version: 0.027
Galileo::Admin:
file: lib/Galileo/Admin.pm
version: 0
Expand Down Expand Up @@ -65,7 +65,7 @@ requires:
File::Copy::Recursive: 0
File::Next: 0
File::ShareDir: 1.00
Mojolicious: 3.85
Mojolicious: 3.92
Mojolicious::Plugin::Humane: 0.04
SQL::Translator: 0
Term::Prompt: 0
Expand All @@ -74,4 +74,4 @@ resources:
bugtracker: http://github.com/jberger/Galileo/issues
license: http://dev.perl.org/licenses/
repository: http://github.com/jberger/Galileo
version: 0.026
version: 0.027
2 changes: 1 addition & 1 deletion lib/Galileo.pm
@@ -1,7 +1,7 @@
package Galileo;
use Mojo::Base 'Mojolicious';

our $VERSION = '0.026';
our $VERSION = '0.027';
$VERSION = eval $VERSION;

use File::Basename 'dirname';
Expand Down
26 changes: 13 additions & 13 deletions t/basic.t
Expand Up @@ -84,7 +84,7 @@ subtest 'Edit Page' => sub {
$t->websocket_ok( '/store/page' )
->send_ok( _send_text $data )
->message_ok
->json_message_is( '/' => { success => 1, message => 'Changes saved' } )
->json_message_is( '' => { success => 1, message => 'Changes saved' } )
->finish_ok;

# see that the changes are reflected
Expand All @@ -103,7 +103,7 @@ subtest 'Edit Page' => sub {
$t->websocket_ok( '/store/page' )
->send_ok( _send_text $data_notitle )
->message_ok
->json_message_is( '/' => { success => 0, message => 'Not saved! A title is required!' })
->json_message_is( '' => { success => 0, message => 'Not saved! A title is required!' })
->finish_ok;

};
Expand All @@ -127,7 +127,7 @@ subtest 'New Page' => sub {
$t->websocket_ok( '/store/page' )
->send_ok( _send_text $data )
->message_ok
->json_message_is( '/' => { success => 1, message => 'Changes saved' })
->json_message_is( '' => { success => 1, message => 'Changes saved' })
->finish_ok;

# see that the changes are reflected
Expand Down Expand Up @@ -155,7 +155,7 @@ subtest 'Edit Main Navigation Menu' => sub {
$t->websocket_ok('/store/menu')
->send_ok( _send_text $data )
->message_ok
->json_message_is( '/' => { success => 1, message => 'Changes saved' })
->json_message_is( '' => { success => 1, message => 'Changes saved' })
->finish_ok;

# check that item is removed
Expand All @@ -172,7 +172,7 @@ subtest 'Edit Main Navigation Menu' => sub {
$t->websocket_ok('/store/menu')
->send_ok( _send_text $data )
->message_ok
->json_message_is( '/' => { success => 1, message => 'Changes saved' })
->json_message_is( '' => { success => 1, message => 'Changes saved' })
->finish_ok;

# check about page is back in nav (same as first test block)
Expand Down Expand Up @@ -205,21 +205,21 @@ subtest 'Administrative Overview: All Pages' => sub {
$t->websocket_ok('/remove/page')
->send_ok( _send_text {id => 1} )
->message_ok
->json_message_is( '/' => { success => 0, message => 'Cannot remove home page' })
->json_message_is( '' => { success => 0, message => 'Cannot remove home page' })
->finish_ok;

# attempt to remove invalid page
$t->websocket_ok('/remove/page')
->send_ok( _send_text {id => 5} )
->message_ok
->json_message_is( '/' => { success => 0, message => 'Could not access page (id 5)' } )
->json_message_is( '' => { success => 0, message => 'Could not access page (id 5)' } )
->finish_ok;

# remove page
$t->websocket_ok('/remove/page')
->send_ok( _send_text {id => 2} )
->message_ok
->json_message_is( '/' => { success => 1, message => 'Page removed' } )
->json_message_is( '' => { success => 1, message => 'Page removed' } )
->finish_ok;

};
Expand All @@ -243,7 +243,7 @@ subtest 'Administer Users' => sub {
$t->websocket_ok('/store/user')
->send_ok( _send_text $data )
->message_ok
->json_message_is( '/' => { success => 1, message => 'Changes saved' } )
->json_message_is( '' => { success => 1, message => 'Changes saved' } )
->finish_ok;

# check that the name change is reflected
Expand All @@ -264,7 +264,7 @@ subtest 'Administer Users' => sub {
$t->websocket_ok('/store/user')
->send_ok( _send_text $data )
->message_ok
->json_message_is( '/' => { success => 0, message => 'Not saved! Passwords do not match' } )
->json_message_is( '' => { success => 0, message => 'Not saved! Passwords do not match' } )
->finish_ok;

ok( $t->app->get_user('admin')->check_password('pass'), 'Password not changed on non-matching passwords');
Expand All @@ -281,7 +281,7 @@ subtest 'Administer Users' => sub {
$t->websocket_ok('/store/user')
->send_ok( _send_text $data )
->message_ok
->json_message_is( '/' => { success => 1, message => 'Changes saved' } )
->json_message_is( '' => { success => 1, message => 'Changes saved' } )
->finish_ok;

ok( $t->app->get_user('admin')->check_password('newpass'), 'New password checks out');
Expand All @@ -300,7 +300,7 @@ subtest 'Create New User' => sub {
$t->websocket_ok('/store/user')
->send_ok( _send_text $data )
->message_ok
->json_message_is( '/' => { success => 0, message => 'Cannot create user without a password' })
->json_message_is( '' => { success => 0, message => 'Cannot create user without a password' })
->finish_ok;

# create a user
Expand All @@ -315,7 +315,7 @@ subtest 'Create New User' => sub {
$t->websocket_ok('/store/user')
->send_ok( _send_text $data )
->message_ok
->json_message_is( '/' => { success => 1, message => 'Changes saved' })
->json_message_is( '' => { success => 1, message => 'Changes saved' })
->finish_ok;

# check the new user
Expand Down
4 changes: 2 additions & 2 deletions t/locations.t
Expand Up @@ -29,7 +29,7 @@ my $image2 = File::Spec->catfile( qw/ img image2.jpg / );
$t->websocket_ok('/files/list')
->send_ok({ text => j({limit => 0}) })
->message_ok
->json_message_is( '/' => { files => [sort 'image1.jpg', $image2], finished => 1 })
->json_message_is( '' => { files => [sort 'image1.jpg', $image2], finished => 1 })
->finish_ok;

# test limited number of files found. note order is not guaranteed
Expand All @@ -46,7 +46,7 @@ $t->websocket_ok('/files/list')
->json_message_is( '/finished' => 0 )
->send_ok({ text => j({limit => 1}) })
->message_ok
->json_message_is( '/' => { files => [], finished => 1 } )
->json_message_is( '' => { files => [], finished => 1 } )
->finish_ok;

done_testing();
Expand Down

0 comments on commit 6bda6a9

Please sign in to comment.