-
Notifications
You must be signed in to change notification settings - Fork 434
/
api_matcher_spec.rb
50 lines (44 loc) · 1.48 KB
/
api_matcher_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
require 'rails_helper'
RSpec.describe 'APIMatcher' do
it 'routes xml format request to API controllers' do
expect(get('/distributions.xml')).to route_to(controller: 'distributions', action: 'index', format: 'xml')
end
it 'distributions in html format should not be routable' do
expect(get('/distributions')).not_to be_routable
end
it 'routes public routes correctly' do
expect(get('/public/source/project/package/file')).to route_to(
controller: 'public',
action: 'source_file',
project: 'project',
package: 'package',
filename: 'file'
)
expect(get('/public/build/project/repository/arch/package/file')).to route_to(
controller: 'public',
action: 'build',
project: 'project',
repository: 'repository',
arch: 'arch',
package: 'package',
file: 'file'
)
end
it 'routes requests to global_command_* correctly' do
expect(post('/source?cmd=orderkiwirepos')).to route_to(
controller: 'source',
action: 'global_command_orderkiwirepos',
cmd: 'orderkiwirepos'
)
expect(post('/source?cmd=branch')).to route_to(
controller: 'source',
action: 'global_command_branch',
cmd: 'branch'
)
expect(post('/source?cmd=createmaintenanceincident')).to route_to(
controller: 'source',
action: 'global_command_createmaintenanceincident',
cmd: 'createmaintenanceincident'
)
end
end