File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,16 @@ def by_uid(uid)
43
43
end
44
44
end
45
45
46
+ ##
47
+ # Set an application's valid redirect URIs.
48
+ #
49
+ # @param uris [String, Array] Newline-separated string or array the URI(s)
50
+ #
51
+ # @return [String] The redirect URI(s) seperated by newlines.
52
+ def redirect_uri = ( uris )
53
+ super ( uris . is_a? ( Array ) ? uris . join ( "\n " ) : uris )
54
+ end
55
+
46
56
private
47
57
48
58
def has_scopes?
Original file line number Diff line number Diff line change @@ -136,6 +136,21 @@ module Doorkeeper
136
136
end
137
137
end
138
138
139
+ describe "#redirect_uri=" do
140
+ context "when array of valid redirect_uris" do
141
+ it "should join by newline" do
142
+ new_application . redirect_uri = [ 'http://localhost/callback1' , 'http://localhost/callback2' ]
143
+ expect ( new_application . redirect_uri ) . to eq ( "http://localhost/callback1\n http://localhost/callback2" )
144
+ end
145
+ end
146
+ context "when string of valid redirect_uris" do
147
+ it "should store as-is" do
148
+ new_application . redirect_uri = "http://localhost/callback1\n http://localhost/callback2"
149
+ expect ( new_application . redirect_uri ) . to eq ( "http://localhost/callback1\n http://localhost/callback2" )
150
+ end
151
+ end
152
+ end
153
+
139
154
describe :authorized_for do
140
155
let ( :resource_owner ) { double ( :resource_owner , id : 10 ) }
141
156
You can’t perform that action at this time.
0 commit comments