Skip to content

Commit

Permalink
Added the object dir with every test ordered into four files.
Browse files Browse the repository at this point in the history
  • Loading branch information
gnusosa authored and fcuny committed Jul 21, 2011
1 parent ea7a762 commit 28838bf
Show file tree
Hide file tree
Showing 13 changed files with 97 additions and 78 deletions.
1 change: 0 additions & 1 deletion lib/Dancer/Script.pm
Expand Up @@ -36,7 +36,6 @@ sub new {
$self->{do_overwrite_all} = 0;
$self->validate_app_name();
#my $AUTO_RELOAD = eval "require Module::Refresh and require Clone" ? 1 : 0;
require Dancer;
$self->{dancer_version} = $Dancer::VERSION;
$self->_set_application_path();
$self->_set_script_path();
Expand Down
41 changes: 41 additions & 0 deletions t/19_dancer/object/01-new.t
@@ -0,0 +1,41 @@
use strict;
use warnings;
use Test::More tests => 15;
use Dancer::Script;

use_ok( 'Dancer::Script' );
my $script = Dancer::Script->new(appname => 'Hello::World', path => '.', check_version => '1');
isa_ok( $script, 'Dancer::Script', );
can_ok( $script, 'parse_opts', 'validate_app_name', );
can_ok( $script, '_set_application_path', '_set_script_path', '_set_lib_path', );

isnt( $script->_dash_name, $script->{appname}, '_dash_name parses appname correctly.');

is( $script->{dancer_app_dir}, $script->{dancer_script}, "_set_application_path sets correctly ->{dancer_app_dir}");


my @lib_path = split('::', $script->{appname});
my ($lib_file, $lib_path) = (pop @lib_path) . ".pm";

is( $script->{lib_file}, $lib_file, "_set_lib_path sets correctly ->{lib_file} and ->{lib_path}");
is( $script->{lib_path}, $lib_path, "_set_lib_path sets correctly ->{lib_file} and ->{lib_path}");

is( $script->{dancer_script}, $script->_dash_name, "_set_script_path sets correctly ->{dancer_script}");

my $list = $script->app_tree;

ok (defined $list, 'app_tree successfully returns a list.');

my $jquery = $script->jquery_minified;

ok ( defined $jquery, 'jquery_minified returns a jquery code.');
ok ( $jquery =~ m/jQuery JavaScript Library/i, 'jQuery string identified.');

my $skip = $script->manifest_skip;

ok ( defined $skip, 'manifest_skip returns a string.');
ok ( $skip =~ m/\.git/i, 'Skip items identified.');

my $templates = $script->templates;

ok ( defined $templates, 'templates method returns a list.');
31 changes: 31 additions & 0 deletions t/19_dancer/object/02-write.t
@@ -0,0 +1,31 @@
use strict;
use warnings;
use Test::More tests => 4;
use File::Temp;
use File::Spec::Functions;
use Dancer::Script;

my $dir = File::Temp->newdir();
my $tmpdir = $dir->dirname;
my $template = { 'test' => 'testing', };
my $script = Dancer::Script->new(appname => 'Hello', path => $tmpdir, check_version => '1');
my $dancer_app_dir = $script->{dancer_app_dir};

#tests

# TODO-to-every-t: Supress the print messages from the *print* outputs.
ok( $script->safe_mkdir($dancer_app_dir),"safe_mkdir method sucessfully wrote a directory.");

ok( $script->run,"successfully created a full Dancer app.");

ok( $script->write_bg(catfile($script->{path},$script->{appname}, 'public', 'images', 'perldancer-bg.jpg')),
"write_data_to_file method sucessfully wrote a file.");

ok( $script->write_file(catfile($script->{path},$script->{appname},'t','test'),$template), "write_file successfully writes a file.");







25 changes: 25 additions & 0 deletions t/19_dancer/object/03-run.t
@@ -0,0 +1,25 @@
use strict;
use warnings;
use Test::More tests => 4;
use File::Temp;
use File::Spec::Functions;
use Dancer::Script;

my $dir = File::Temp->newdir();
my $tmpdir = $dir->dirname;
my $script = Dancer::Script->new(appname => 'Hello', path => $tmpdir, check_version => '1');

#tests
# TODO: Supress the print messages from the *print* outputs.
can_ok( $script, 'run');

# -new->run() write test.
ok( $script->run,"successfully created a full Dancer app.");








6 changes: 0 additions & 6 deletions t/19_dancer/object/_dash_name.t

This file was deleted.

6 changes: 0 additions & 6 deletions t/19_dancer/object/_set_application_path.t

This file was deleted.

9 changes: 0 additions & 9 deletions t/19_dancer/object/_set_lib_path.t

This file was deleted.

6 changes: 0 additions & 6 deletions t/19_dancer/object/_set_script_path.t

This file was deleted.

10 changes: 0 additions & 10 deletions t/19_dancer/object/app_tree.t

This file was deleted.

10 changes: 0 additions & 10 deletions t/19_dancer/object/jquery_minified.t

This file was deleted.

10 changes: 0 additions & 10 deletions t/19_dancer/object/manifest_skip.t

This file was deleted.

11 changes: 0 additions & 11 deletions t/19_dancer/object/new.t

This file was deleted.

9 changes: 0 additions & 9 deletions t/19_dancer/object/templates.t

This file was deleted.

0 comments on commit 28838bf

Please sign in to comment.