NAME
Rex::Test::Spec - Write Rex::Test like RSpec!
VERSION
Version 0.02
SYNOPSIS
Quick summary of what the module does.
Perhaps a little code snippet.
use Rex::Test::Spec;
describe "Nginx Test", sub {
context run("nginx -t"), "nginx.conf testing", sub {
like its('stdout'), qr/ok/;
};
context file("/etc/nginx.conf"), sub {
is its('ensure'), 'present';
like its('content'), qr/listen\s+80;/;
};
context service("nginx"), sub {
is its('ensure'), 'running';
};
context pkg("nginx"), sub {
is its('ensure'), 'present';
is its('version'), '1.5.8';
};
context cron, sub {
like its('www'), 'logrotate';
};
context gateway, sub {
is its('value'), '192.168.0.1';
};
context group('www'), sub {
ok its('ensure');
};
context iptables, sub {
};
context port(80), sub {
is its('bind'), '0.0.0.0';
is its('proto'), 'tcp';
is its('command'), 'nginx';
};
context process('nginx'), sub {
like its('command'), qr(nginx -c /etc/nginx.conf);
ok its('mem') > 1024;
};
context routes, sub {
is_deeply its(1), {
destination => $dest,
gateway => $gw,
genmask => $genmask,
flags => $flags,
mss => $mss,
irtt => $irtt,
iface => $iface,
};
};
context sysctl, sub {
is its('vm.swapiness'), 1;
};
context user('www'), sub {
ok its('ensure');
is its('home'), '/var/www/html';
is its('shell'), '/sbin/nologin';
is_deeply its('belong_to'), ['www', 'nogroup'];
};
};
done_testing;
EXPORT
A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented module.
SUBROUTINES/METHODS
describe
context
its
AUTHOR
Rao Chenlin(chenryn), <rao.chenlin at gmail.com>
BUGS
Please report any bugs or feature requests to bug-rex-test-spec at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Rex-Test-Spec. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Rex::Test::Spec
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2014 Rao Chenlin(chenryn).
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.