Fix flaky web push test and deduplicate DNS stub helper (#2825)
* Extract shared DnsTestHelper from duplicated stub_dns_resolution methods * Fix flaky WebTest by stubbing DNS resolution for push subscription creation
This commit is contained in:
@@ -247,11 +247,4 @@ class FlatJsonParamsTest < ActionDispatch::IntegrationTest
|
||||
assert_response :no_content
|
||||
assert_equal "Flat Join", users(:david).reload.name
|
||||
end
|
||||
|
||||
private
|
||||
def stub_dns_resolution(*ips)
|
||||
dns_mock = mock("dns")
|
||||
dns_mock.stubs(:each_address).multiple_yields(*ips)
|
||||
Resolv::DNS.stubs(:open).yields(dns_mock)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -92,11 +92,4 @@ class Users::PushSubscriptionsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
assert_response :unprocessable_entity
|
||||
end
|
||||
|
||||
private
|
||||
def stub_dns_resolution(*ips)
|
||||
dns_mock = mock("dns")
|
||||
dns_mock.stubs(:each_address).multiple_yields(*ips)
|
||||
Resolv::DNS.stubs(:open).yields(dns_mock)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user