Skip to content

Commit 062919d

Browse files
committed
Added tests for Authorization: Bearer.
1 parent 42791e7 commit 062919d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

spec/features/swagger_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,22 @@
4545
expect(page).to have_css "span.string", text: "Basic #{Base64.encode64('username:password').strip}"
4646
end
4747
end
48+
context "#api_auth:bearer" do
49+
before do
50+
GrapeSwaggerRails.options.api_auth = 'bearer'
51+
GrapeSwaggerRails.options.api_key_name = 'Authorization'
52+
GrapeSwaggerRails.options.api_key_type = 'header'
53+
visit '/swagger'
54+
end
55+
it 'adds an Authorization header' do
56+
fill_in 'apiKey', with: 'token'
57+
find('#endpointListTogger_headers', visible: true).click
58+
find('a[href="#!/headers/GET_api_headers_format"]', visible: true).click
59+
click_button 'Try it out!'
60+
expect(page).to have_css "span.attribute", text: 'Authorization'
61+
expect(page).to have_css "span.string", text: 'Bearer token'
62+
end
63+
end
4864
context "#api_auth:token" do
4965
before do
5066
GrapeSwaggerRails.options.api_key_name = 'api_token'

0 commit comments

Comments
 (0)