CatalystX-Test-MockContext

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

      },
      "test" : {
         "recommends" : {
            "CPAN::Meta" : "2.120900"
         },
         "requires" : {
            "Catalyst" : "0",
            "Catalyst::Controller" : "0",
            "File::Spec" : "0",
            "FindBin" : "0",
            "HTTP::Request::Common" : "0",
            "IO::Handle" : "0",
            "IPC::Open3" : "0",
            "Module::Metadata" : "1.000015",
            "Moose" : "0",
            "Test::Exception" : "0",
            "Test::More" : "0",
            "lib" : "0",
            "perl" : "5.006"
         }
      }

META.yml  view on Meta::CPAN

---
abstract: 'Conveniently create $c objects for testing'
author:
  - 'Eden Cardim <edencardim@gmail.com>'
build_requires:
  Catalyst: '0'
  Catalyst::Controller: '0'
  ExtUtils::MakeMaker: '7.22'
  File::Spec: '0'
  FindBin: '0'
  HTTP::Request::Common: '0'
  IO::Handle: '0'
  IPC::Open3: '0'
  Module::Metadata: '1.000015'
  Moose: '0'
  Test::Exception: '0'
  Test::More: '0'
  lib: '0'
  perl: '5.006'
configure_requires:
  ExtUtils::MakeMaker: '0'

Makefile.PL  view on Meta::CPAN

    "Plack::Test" => 0,
    "Sub::Exporter" => 0,
    "strict" => 0,
    "warnings" => 0
  },
  "TEST_REQUIRES" => {
    "Catalyst" => 0,
    "Catalyst::Controller" => 0,
    "File::Spec" => 0,
    "FindBin" => 0,
    "HTTP::Request::Common" => 0,
    "IO::Handle" => 0,
    "IPC::Open3" => 0,
    "Module::Metadata" => "1.000015",
    "Moose" => 0,
    "Test::Exception" => 0,
    "Test::More" => 0,
    "lib" => 0
  },
  "VERSION" => "0.000004",
  "test" => {

Makefile.PL  view on Meta::CPAN

);


my %FallbackPrereqs = (
  "Catalyst" => 0,
  "Catalyst::Controller" => 0,
  "Class::Load" => 0,
  "ExtUtils::MakeMaker" => "7.22",
  "File::Spec" => 0,
  "FindBin" => 0,
  "HTTP::Request::Common" => 0,
  "IO::Handle" => 0,
  "IPC::Open3" => 0,
  "Module::Metadata" => "1.000015",
  "Moose" => 0,
  "Plack::Test" => 0,
  "Sub::Exporter" => 0,
  "Test::Exception" => 0,
  "Test::More" => 0,
  "lib" => 0,
  "strict" => 0,

README.md  view on Meta::CPAN


CatalystX::Test::MockContext - Conveniently create $c objects for testing

# VERSION

version 0.000004

# SYNOPSIS

```perl
use HTTP::Request::Common;
use CatalystX::Test::MockContext;

my $m = mock_context('MyApp');
my $c = $m->(GET '/');
```

# EXPORTS

## mock\_context

```perl
my $sub = mock_context('MyApp');
```

This function returns a closure that takes an [HTTP::Request](https://metacpan.org/pod/HTTP%3A%3ARequest) object and returns a
[Catalyst](https://metacpan.org/pod/Catalyst) context object for that request.

# SOURCE

The development version is on github at [https://github.com/robrwo/CatalystX-Test-MockContext](https://github.com/robrwo/CatalystX-Test-MockContext)
and may be cloned from [git://github.com/robrwo/CatalystX-Test-MockContext.git](git://github.com/robrwo/CatalystX-Test-MockContext.git)

# BUGS

Please report any bugs or feature requests on the bugtracker website

cpanfile  view on Meta::CPAN

on 'build' => sub {
  requires "ExtUtils::MakeMaker" => "7.22";
  requires "Module::Metadata" => "1.000015";
};

on 'test' => sub {
  requires "Catalyst" => "0";
  requires "Catalyst::Controller" => "0";
  requires "File::Spec" => "0";
  requires "FindBin" => "0";
  requires "HTTP::Request::Common" => "0";
  requires "IO::Handle" => "0";
  requires "IPC::Open3" => "0";
  requires "Module::Metadata" => "1.000015";
  requires "Moose" => "0";
  requires "Test::Exception" => "0";
  requires "Test::More" => "0";
  requires "lib" => "0";
  requires "perl" => "5.006";
};

lib/CatalystX/Test/MockContext.pm  view on Meta::CPAN

=head1 NAME

CatalystX::Test::MockContext - Conveniently create $c objects for testing

=head1 VERSION

version 0.000004

=head1 SYNOPSIS

  use HTTP::Request::Common;
  use CatalystX::Test::MockContext;

  my $m = mock_context('MyApp');
  my $c = $m->(GET '/');

=head1 EXPORTS

=head2 mock_context

 my $sub = mock_context('MyApp');

This function returns a closure that takes an L<HTTP::Request> object and returns a
L<Catalyst> context object for that request.

=head1 SOURCE

The development version is on github at L<https://github.com/robrwo/CatalystX-Test-MockContext>
and may be cloned from L<git://github.com/robrwo/CatalystX-Test-MockContext.git>

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website

t/00-report-prereqs.dd  view on Meta::CPAN

                    },
       'test' => {
                   'recommends' => {
                                     'CPAN::Meta' => '2.120900'
                                   },
                   'requires' => {
                                   'Catalyst' => '0',
                                   'Catalyst::Controller' => '0',
                                   'File::Spec' => '0',
                                   'FindBin' => '0',
                                   'HTTP::Request::Common' => '0',
                                   'IO::Handle' => '0',
                                   'IPC::Open3' => '0',
                                   'Module::Metadata' => '1.000015',
                                   'Moose' => '0',
                                   'Test::Exception' => '0',
                                   'Test::More' => '0',
                                   'lib' => '0',
                                   'perl' => '5.006'
                                 }
                 }

t/100-basic.t  view on Meta::CPAN

use warnings;
use strict;

use Test::More;
use Test::Exception;
use HTTP::Request::Common;
use CatalystX::Test::MockContext;
use FindBin;
use lib "t/lib";
use MyApp;

{
  my $myapp = mock_context('MyApp');
  my $c     = $myapp->( GET '/' );
  isa_ok($c, 'MyApp');
  lives_ok { $c->stash } 'has stash';



( run in 0.819 second using v1.01-cache-2.11-cpan-de7293f3b23 )