Newer
Older

Israel Barreto Sant'Anna
committed
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
51
52
53
54
55
require 'test_helper'
class V1::RatingControllerTest < ActionController::TestCase
tests V1::RatingsController
include Devise::TestHelpers
test 'should get index' do
skip('Unsolved issue: ArgumentError: wrong number of arguments (2 for 0)')
end
test 'should user show rating' do
auth_application
usability = ratings(:usability)
get :show, id: usability.id
assert_response :ok
end
test 'should user post rating to create and return :unauthorized' do
post :create, rating: {name: 'my rating',description: 'testing rating'}
assert_response :unauthorized
end
test 'should user post rating to create and return :created code' do
auth_request users(:jack)
post :create, rating: {name: 'my rating',description: 'testing rating'}
assert_response :created
end
test 'should user put rating to update and return :ok' do
auth_request users(:jack)
usability = ratings(:usability)
put :update, id: usability.id , rating: { description: 'testing rating'}
assert_response :ok
end
test 'should user put rating to update and return :unauthorized' do
usability = ratings(:usability)
put :update, id: usability.id , rating: { description: 'testing rating'}
assert_response :unauthorized
end
test 'should user delete rating to destroy and return :ok' do
auth_request users(:jack)
usability = ratings(:usability)
delete :destroy, id: usability.id
assert_response :ok
end
test 'should user delete rating to destroy and return :unauthorized' do
usability = ratings(:usability)
delete :destroy, id: usability.id
assert_response :unauthorized
end
end