Browse Source

fix pwb test

George S. Baugh 2 years ago
parent
commit
7b82324588
2 changed files with 7 additions and 4 deletions
  1. 4 0
      lib/Playwright/Base.pm
  2. 3 4
      t/Playwright-Base.t

+ 4 - 0
lib/Playwright/Base.pm

@@ -116,4 +116,8 @@ sub _do ( $self, %args ) {
         $self->{ua}, %args );
         $self->{ua}, %args );
 }
 }
 
 
+sub spec {
+    return $Playwright::spec;
+}
+
 1;
 1;

+ 3 - 4
t/Playwright-Base.t

@@ -41,13 +41,13 @@ no warnings qw{redefine once};
 local *Playwright::Fake::new = sub {
 local *Playwright::Fake::new = sub {
     my ($class,%options) = @_;
     my ($class,%options) = @_;
     return bless( {
     return bless( {
-        spec => $Playwright::spec->{$options{type}}{members},
         type => $options{type},
         type => $options{type},
         guid => $options{id},
         guid => $options{id},
         ua   => $options{handle}{ua},
         ua   => $options{handle}{ua},
         port => $options{handle}{port},
         port => $options{handle}{port},
     }, $class);
     }, $class);
 };
 };
+local *Playwright::Fake::spec = sub { return $Playwright::spec->{Fake}{members} };
 use warnings;
 use warnings;
 
 
 my $obj = CLASS()->new(
 my $obj = CLASS()->new(
@@ -55,8 +55,7 @@ my $obj = CLASS()->new(
     id   => 666,
     id   => 666,
     handle => { ua => 'bogus', port => 420 },
     handle => { ua => 'bogus', port => 420 },
 );
 );
-
-is($obj->{spec}, $Playwright::spec->{Fake}{members}, "Spec correctly filed by constructor");
+is($obj->spec, $Playwright::spec, "Spec correctly filed by constructor");
 
 
 my %in = (
 my %in = (
     command => 'tickle',
     command => 'tickle',
@@ -70,7 +69,7 @@ my %expected = (
     args    => [{ intense => JSON::true, tickler => 'bigtime' }, JSON::false, 'boom'],
     args    => [{ intense => JSON::true, tickler => 'bigtime' }, JSON::false, 'boom'],
 );
 );
 
 
-my %out = Playwright::Base::_coerce($obj->{spec}, %in);
+my %out = Playwright::Base::_coerce($obj->spec->{Fake}{members}, %in);
 
 
 is(\%out, \%expected, "_coerce correctly transforms bools and leaves everything else alone");
 is(\%out, \%expected, "_coerce correctly transforms bools and leaves everything else alone");