|
39 | 39 | it 'adds an Authorization header' do
|
40 | 40 | fill_in 'apiKey', with: 'username:password'
|
41 | 41 | find('#endpointListTogger_headers', visible: true).click
|
42 |
| - find('a[href="#!/headers/GET_api_headers_format"]', visible: true).click |
| 42 | + first('a[href="#!/headers/GET_api_headers_format"]', visible: true).click |
43 | 43 | click_button 'Try it out!'
|
44 | 44 | expect(page).to have_css "span.attribute", text: 'Authorization'
|
45 | 45 | expect(page).to have_css "span.string", text: "Basic #{Base64.encode64('username:password').strip}"
|
|
55 | 55 | it 'adds an Authorization header' do
|
56 | 56 | fill_in 'apiKey', with: 'token'
|
57 | 57 | find('#endpointListTogger_headers', visible: true).click
|
58 |
| - find('a[href="#!/headers/GET_api_headers_format"]', visible: true).click |
| 58 | + first('a[href="#!/headers/GET_api_headers_format"]', visible: true).click |
59 | 59 | click_button 'Try it out!'
|
60 | 60 | expect(page).to have_css "span.attribute", text: 'Authorization'
|
61 | 61 | expect(page).to have_css "span.string", text: 'Bearer token'
|
|
70 | 70 | it 'adds an api_token query parameter' do
|
71 | 71 | fill_in 'apiKey', with: 'dummy'
|
72 | 72 | find('#endpointListTogger_params', visible: true).click
|
73 |
| - find('a[href="#!/params/GET_api_params_format"]', visible: true).click |
| 73 | + first('a[href="#!/params/GET_api_params_format"]', visible: true).click |
74 | 74 | click_button 'Try it out!'
|
75 | 75 | expect(page).to have_css "span.attribute", text: 'api_token'
|
76 | 76 | expect(page).to have_css "span.string", text: "dummy"
|
|
90 | 90 | expect(page).to have_content "Unauthorized Access"
|
91 | 91 | end
|
92 | 92 | end
|
| 93 | + context "#app_name" do |
| 94 | + context 'set' do |
| 95 | + before do |
| 96 | + GrapeSwaggerRails.options.app_name = "Test App" |
| 97 | + visit '/swagger' |
| 98 | + end |
| 99 | + it 'sets page title' do |
| 100 | + expect(page.title).to eq "Test App" |
| 101 | + end |
| 102 | + end |
| 103 | + context 'not set' do |
| 104 | + before do |
| 105 | + visit '/swagger' |
| 106 | + end |
| 107 | + it 'defaults page title' do |
| 108 | + expect(page.title).to eq "Swagger" |
| 109 | + end |
| 110 | + end |
| 111 | + end |
93 | 112 | after do
|
94 | 113 | GrapeSwaggerRails.options = @options
|
95 | 114 | end
|
|
0 commit comments