APISchema

 view release on metacpan or  search on metacpan

t/APISchema-DSL.t  view on Meta::CPAN

package t::APISchema::Generator::Router::Simple;
use lib '.';
use t::test;
use Encode qw(decode_utf8);

sub _require : Test(startup => 1) {
    my ($self) = @_;

    BEGIN{ use_ok 'APISchema::DSL'; }
}

sub no_global : Tests {
    dies_ok {
        filter {};
    };

    dies_ok {
        title 'test';
    };

    dies_ok {
        description 'test';
    };

    dies_ok {
        resource 'test' => ();
    };

    dies_ok {
        GET '/' => ();
    };

    dies_ok {
        POST '/' => ();
    };

}

sub process : Tests {
    lives_ok {
        my $schema = APISchema::DSL::process {};
        isa_ok $schema, 'APISchema::Schema';
    };

    dies_ok {
        GET '/' => ();
    };

    subtest 'title, description' => sub {
        lives_ok {
            my $schema = APISchema::DSL::process {
                title 'BMI API';
                description 'The API to calculate BMI';
            };
            isa_ok $schema, 'APISchema::Schema';
            is $schema->title, 'BMI API';
            is $schema->description, 'The API to calculate BMI';
        };
    };

    subtest 'Simple GET' => sub {
        lives_ok {



( run in 2.391 seconds using v1.01-cache-2.11-cpan-437f7b0c052 )