File tree 6 files changed +11
-4
lines changed
spec/lib/pact_broker/api/resources
6 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,11 @@ def base_url
62
62
PactBroker . configuration . base_url || request . base_uri . to_s . chomp ( '/' )
63
63
end
64
64
65
+ # See comments for base_url in lib/pact_broker/doc/controllers/app.rb
66
+ def ui_base_url
67
+ PactBroker . configuration . base_url || ''
68
+ end
69
+
65
70
def charsets_provided
66
71
[ [ 'utf-8' , :encode ] ]
67
72
end
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def to_extended_json
36
36
def to_html
37
37
PactBroker . configuration . html_pact_renderer . call (
38
38
pact , {
39
- base_url : base_url ,
39
+ base_url : ui_base_url ,
40
40
badge_url : "#{ resource_url } /badge.svg"
41
41
} )
42
42
end
Original file line number Diff line number Diff line change @@ -77,8 +77,8 @@ def to_extended_json
77
77
def to_html
78
78
PactBroker . configuration . html_pact_renderer . call (
79
79
pact , {
80
- base_url : base_url ,
81
- badge_url : badge_url_for_latest_pact ( pact , base_url )
80
+ base_url : ui_base_url ,
81
+ badge_url : badge_url_for_latest_pact ( pact , ui_base_url )
82
82
} )
83
83
end
84
84
Original file line number Diff line number Diff line change 10
10
11
11
.container
12
12
.navbar-right
13
- %a {href: base_url}
13
+ %a {href: "#{ base_url}/" }
14
14
Home
15
15
%h1 .page-header
16
16
= title
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ module Resources
21
21
before do
22
22
allow ( PactBroker ::Pacts ::Service ) . to receive ( :find_latest_pact ) . and_return ( pact )
23
23
allow ( PactBroker . configuration . html_pact_renderer ) . to receive ( :call ) . and_return ( html )
24
+ allow_any_instance_of ( LatestPact ) . to receive ( :ui_base_url ) . and_return ( 'http://example.org' )
24
25
end
25
26
26
27
subject { get ( path , nil , 'HTTP_ACCEPT' => accept ) }
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ module Resources
24
24
25
25
before do
26
26
allow_any_instance_of ( Pact ) . to receive ( :badge_url_for_latest_pact ) . and_return ( 'http://badge' )
27
+ allow_any_instance_of ( Pact ) . to receive ( :ui_base_url ) . and_return ( 'http://example.org' )
27
28
allow ( PactBroker ::Pacts ::Service ) . to receive ( :find_pact ) . and_return ( pact )
28
29
allow ( PactBroker . configuration . html_pact_renderer ) . to receive ( :call ) . and_return ( html )
29
30
end
You can’t perform that action at this time.
0 commit comments