mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2010-04-20 09:29 am

[dw-free] fix t/settings.t

[commit: http://hg.dwscoalition.org/dw-free/rev/f359f9ff8358]

http://bugs.dwscoalition.org/show_bug.cgi?id=2493

Fix settings test, and a bug in the Gender setting module.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/Setting/Gender.pm
  • t/settings.t
--------------------------------------------------------------------------------
diff -r b08e1279c61b -r f359f9ff8358 cgi-bin/LJ/Setting/Gender.pm
--- a/cgi-bin/LJ/Setting/Gender.pm	Tue Apr 20 09:25:50 2010 +0000
+++ b/cgi-bin/LJ/Setting/Gender.pm	Tue Apr 20 09:29:50 2010 +0000
@@ -44,7 +44,7 @@ sub error_check {
 sub error_check {
     my ( $class, $u, $args ) = @_;
     my $val = $class->get_arg( $args, "gender" );
-    $class->errors( access => $class->ml( '.setting.gender.error.wrongtype' ) ) if $u->is_individual;
+    $class->errors( access => $class->ml( '.setting.gender.error.wrongtype' ) ) unless $u->is_individual;
     $class->errors( gender => $class->ml( '.setting.gender.error.invalid' ) ) unless $val =~ /^[UMFO]$/;
     return 1;
 }
diff -r b08e1279c61b -r f359f9ff8358 t/settings.t
--- a/t/settings.t	Tue Apr 20 09:25:50 2010 +0000
+++ b/t/settings.t	Tue Apr 20 09:29:50 2010 +0000
@@ -6,22 +6,18 @@ require 'ljlib.pl';
 require 'ljlib.pl';
 use LJ::Lang;
 
-#plan tests => ;
-plan skip_all => 'Fix this test! LJ/Setting/WebpageURL.pm is missing';
+plan tests => 9;
 
 package LJ;
 require 'htmlcontrols.pl';
 package main;
 
 
-#use LJ::Setting::WebpageURL;
 use LJ::Setting::Gender;
 use LJ::Setting::Name;
 
-my $webkey = LJ::Setting::WebpageURL->pkgkey;
 my $genkey = LJ::Setting::Gender->pkgkey;
 my $namekey = LJ::Setting::Name->pkgkey;
-is($webkey, "LJ__Setting__WebpageURL_", "key check");
 is($genkey, "LJ__Setting__Gender_",     "key check");
 
 my $u = LJ::load_user("system");
--------------------------------------------------------------------------------