Skip to content

Commit c040a15

Browse files
fix for service hook url check (#1122)
1 parent b6b314c commit c040a15

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/travis/api/v3/github.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def deactivate_service_hook(repo)
8888
end
8989

9090
def service_hook(repo)
91-
hooks(repo).detect { |h| h['name'] == 'travis' && h.dig('config', 'domain') == service_hook_url.host }
91+
hooks(repo).detect { |h| h['name'] == 'travis' && h.dig('config', 'domain') == service_hook_url.to_s }
9292
end
9393

9494
def service_hook_url?(repo)

spec/v3/services/repository/activate_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
stub_request(:get, "https://api.github.com/repositories/#{repo.github_id}/hooks?per_page=100").to_return(
7272
status: 200, body: JSON.dump(
7373
[
74-
{ name: 'travis', url: "https://api.github.com/repositories/#{repo.github_id}/hooks/123", config: { domain: 'url.of.listener.something' } },
74+
{ name: 'travis', url: "https://api.github.com/repositories/#{repo.github_id}/hooks/123", config: { domain: 'https://url.of.listener.something' } },
7575
{ name: 'web', url: "https://api.github.com/repositories/#{repo.github_id}/hooks/456", config: { url: Travis.config.service_hook_url } }
7676
]
7777
)

spec/v3/services/repository/deactivate_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
stub_request(:get, "https://api.github.com/repositories/#{repo.github_id}/hooks?per_page=100").to_return(
6363
status: 200, body: JSON.dump(
6464
[
65-
{ name: 'travis', url: "https://api.github.com/repositories/#{repo.github_id}/hooks/123", config: { domain: 'url.of.listener.something' } },
65+
{ name: 'travis', url: "https://api.github.com/repositories/#{repo.github_id}/hooks/123", config: { domain: 'https://url.of.listener.something' } },
6666
{ name: 'web', url: "https://api.github.com/repositories/#{repo.github_id}/hooks/456", config: { url: Travis.config.service_hook_url } }
6767
]
6868
)
@@ -104,7 +104,7 @@
104104
stub_request(:get, "https://api.github.com/repositories/#{repo.github_id}/hooks?per_page=100").to_return(
105105
status: 200, body: JSON.dump(
106106
[
107-
{ name: 'travis', url: "https://api.github.com/repositories/#{repo.github_id}/hooks/123", config: { domain: 'url.of.listener.something' } }
107+
{ name: 'travis', url: "https://api.github.com/repositories/#{repo.github_id}/hooks/123", config: { domain: 'https://url.of.listener.something' } }
108108
]
109109
)
110110
)

0 commit comments

Comments
 (0)