Created
August 14, 2012 16:00
-
-
Save Ovid/3350491 to your computer and use it in GitHub Desktop.
throws_ok should use classnames, not regexes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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