Skip to content

Instantly share code, notes, and snippets.

@Ovid
Created August 14, 2012 16:00
Show Gist options
  • Save Ovid/3350491 to your computer and use it in GitHub Desktop.
Save Ovid/3350491 to your computer and use it in GitHub Desktop.
throws_ok should use classnames, not regexes
throws_ok { $job_rs->add_job }
qr/Mandatory parameters.*missing/,
'... and it should fail with no arguments';
my %args = (
third_party_key => 'not a valid key',
client_id => 1111111111,
campaign_id => 2222222222,
ad_group_id => 3333333333,
);
throws_ok { $job_rs->add_job(\%args) }
qr/The 'third_party_key' parameter/,
'... or if the third party key is invalid';
$args{third_party_key} = 'adwords';
# this error message was slightly altered
throws_ok { $job_rs->add_job(\%args) }
qr/Table.*1111111111.*doesn't exist/,
'... or if the account does not exist';
my $account = $schema->resultset('Account')->first;
$args{client_id} = $account->id;
throws_ok { $job_rs->add_job(\%args) }
qr/cannot find campaign for '2222222222'/,
'... or if the campaign does not exist';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment