File: basic_steps.pl

package info (click to toggle)
libtest-bdd-cucumber-perl 0.87-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 716 kB
  • sloc: perl: 4,493; makefile: 8
file content (37 lines) | stat: -rw-r--r-- 800 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!perl
 
use strict;
use warnings;

use Digest;

use Test::More;
use Test::BDD::Cucumber::StepFile;
 
Dado qr/la clase "(\w+)"/, sub {
	use_ok( C->matches->[0] );
};

Dado qr/un objeto Digest usando el algoritmo "(\S+)"/, sub {
   my $object = Digest->new( C->matches->[0] );
   ok( $object, "Objecto creado" );
   S->{'object'} = $object;
};

Cuando qr/he agregado "(\w+)" al objeto/, sub {
   S->{'object'}->add( C->matches->[0] );
};
 
Cuando "he agregado los siguientes datos al objeto", sub {
   S->{'object'}->add( C->data );
};

Entonces qr/el resultado (?:en\s*)?(\w+) es "(.+)"/, sub {
    my ( $type, $expected ) = @{ C->matches };
    my $method = {
        'base64' 		=>	'b64digest',
        'hexadecimal'	=>	'hexdigest'
    }->{$type};

    is( S->{'object'}->$method(), $expected );
};