Test::Behaviour::Spec - Interiors of tests for the Behaviour Driven Developments.
Version 0.02
use Test::Behaviour::Spec; use Test::More tests => 5; BEGIN { use_ok('Counter') } { describe 'Counter'; it 'should create an instance.'; ok ref(Counter->new), spec; } { describe '$counter, when counting up,'; my $counter = Counter->new; it 'should has a initial value zero.'; is $counter->value, 0, spec; my $v = $counter->value; it 'should count up.'; ok $counter->can('up'), spec; $counter->up; it 'should return a succeed value from the initial one.'; is $counter->value, $v + 1, spec; }
Let's play believe that we are the Behaviour Driven Developers, putting some additional interiors in our tests. This module provides you such interiors of three subroutines: 'describe', 'it', and 'spec'. The naming of them are based on the RSpec that is a Behaviour Driven Development (BDD) framework for the ruby programing language.
describe "SUBJECT, when SITUATON,"
The subroutine 'describe' calls a name of a subject with a situation.
it "should behave ..."
The subroutine 'it' becomes a subject in the behaviour statement.
spec
The subroutine 'spec' builds a test name as a statement string with a subject at last describe subroutine and a statement at the last it subroutine.
describe
it
None.
Test::More::Behaviours is gives you behaviours in a code reference.
http://rspec.info/ is the original Behaviour Driven Development framework for Ruby.
MIZUTANI Tociyuki <tociyuki@gmail.com>
<tociyuki@gmail.com>
Copyright (c) 2009, MIZUTANI Tociyuki <tociyuki@gmail.com>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Test::Behaviour::Spec, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Behaviour::Spec
CPAN shell
perl -MCPAN -e shell install Test::Behaviour::Spec
For more information on module installation, please visit the detailed CPAN module installation guide.