33class GitHubLdapReferralChaserTestCases < GitHub ::Ldap ::Test
44
55 def setup
6- @mock_connection = GitHub ::Ldap . new ( options )
7- @chaser = GitHub ::Ldap ::ReferralChaser . new ( @mock_connection )
6+ @ldap = GitHub ::Ldap . new ( options )
7+ @chaser = GitHub ::Ldap ::ReferralChaser . new ( @ldap )
88 end
99
1010 def test_creates_referral_with_connection_credentials
11- @mock_connection . expects ( :search ) . yields ( { search_referrals : [ "referral string" ] } ) . returns ( [ ] )
11+ @ldap . expects ( :search ) . yields ( { search_referrals : [ "referral string" ] } ) . returns ( [ ] )
1212
1313 referral = mock ( "GitHub::Ldap::ReferralChaser::Referral" )
1414 referral . stubs ( :search ) . returns ( [ ] )
@@ -21,19 +21,19 @@ def test_creates_referral_with_connection_credentials
2121 end
2222
2323 def test_creates_referral_with_default_port
24- @mock_connection . expects ( :search ) . yields ( {
24+ @ldap . expects ( :search ) . yields ( {
2525 search_referrals : [ "ldap://dc1.ghe.local/CN=Maggie%20Mae,CN=Users,DC=dc4,DC=ghe,DC=local" ]
2626 } ) . returns ( [ ] )
2727
2828 stub_referral_connection = mock ( "GitHub::Ldap" )
2929 stub_referral_connection . stubs ( :search ) . returns ( [ ] )
3030 GitHub ::Ldap ::ConnectionCache . expects ( :get_connection ) . with ( has_entry ( port : options [ :port ] ) ) . returns ( stub_referral_connection )
31- chaser = GitHub ::Ldap ::ReferralChaser . new ( @mock_connection )
31+ chaser = GitHub ::Ldap ::ReferralChaser . new ( @ldap )
3232 chaser . search ( { } )
3333 end
3434
3535 def test_creates_referral_for_first_referral_string
36- @mock_connection . expects ( :search ) . multiple_yields ( [
36+ @ldap . expects ( :search ) . multiple_yields ( [
3737 { search_referrals :
3838 [ "ldap://dc1.ghe.local/CN=Maggie%20Mae,CN=Users,DC=dc4,DC=ghe,DC=local" ,
3939 "ldap://dc2.ghe.local/CN=Maggie%20Mae,CN=Users,DC=dc4,DC=ghe,DC=local" ]
@@ -60,7 +60,7 @@ def test_creates_referral_for_first_referral_string
6060 end
6161
6262 def test_returns_referral_search_results
63- @mock_connection . expects ( :search ) . multiple_yields ( [
63+ @ldap . expects ( :search ) . multiple_yields ( [
6464 { search_referrals :
6565 [ "ldap://dc1.ghe.local/CN=Maggie%20Mae,CN=Users,DC=dc4,DC=ghe,DC=local" ,
6666 "ldap://dc2.ghe.local/CN=Maggie%20Mae,CN=Users,DC=dc4,DC=ghe,DC=local" ]
@@ -82,7 +82,7 @@ def test_returns_referral_search_results
8282 end
8383
8484 def test_returns_referral_search_results
85- @mock_connection . expects ( :search ) . yields ( { foo : [ "not a referral" ] } )
85+ @ldap . expects ( :search ) . yields ( { foo : [ "not a referral" ] } )
8686
8787 GitHub ::Ldap ::ReferralChaser ::Referral . expects ( :new ) . never
8888 results = @chaser . search ( { } )
0 commit comments