diff --git a/tests/rules.test b/tests/rules.test
index 1b3246c..79927df 100644
--- a/tests/rules.test
+++ b/tests/rules.test
@@ -1883,7 +1883,9 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
     // Test sending mail to all users of a role. First make sure there is a
     // custom role and a user for it.
     $user = $this->drupalCreateUser(array('administer nodes'));
-    $roles = array_keys($user->roles);
+    $roles = $user->roles;
+    unset($roles[DRUPAL_AUTHENTICATED_RID]);
+    $roles = array_keys($roles);
     rules_action('mail_to_users_of_role', $settings + array('roles' => $roles))->execute();
     $this->assertMail('to', $user->mail, 'Mail to users of a role has been sent.');
 
