@@ -5,7 +5,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
55 token = JwtWrapper . encode ( user_id : users ( :yo ) . id )
66 VCR . use_cassette ( 'q super cool search' ) do
77 get '/api/v1/search?q=super+cool+search' ,
8- headers : { ' Authorization' : "Bearer #{ token } " }
8+ headers : { Authorization : "Bearer #{ token } " }
99 assert_equal ( 200 , response . status )
1010 json = JSON . parse ( response . body )
1111 assert_equal ( 21_502 , json [ 'hits' ] )
@@ -16,7 +16,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
1616 token = JwtWrapper . encode ( user_id : 'fakeid' )
1717 VCR . use_cassette ( 'invalid token' ) do
1818 get '/api/v1/search?q=super+cool+search' ,
19- headers : { ' Authorization' : "Bearer #{ token } " }
19+ headers : { Authorization : "Bearer #{ token } " }
2020 assert_equal ( 200 , response . status )
2121 json = JSON . parse ( response . body )
2222 assert_equal ( 100 , json [ 'request_limit' ] )
@@ -29,7 +29,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
2929 end
3030 VCR . use_cassette ( 'expired token' ) do
3131 get '/api/v1/search?q=super+cool+search' ,
32- headers : { ' Authorization' : "Bearer #{ token } " }
32+ headers : { Authorization : "Bearer #{ token } " }
3333 assert_equal ( 200 , response . status )
3434 json = JSON . parse ( response . body )
3535 assert_equal ( 100 , json [ 'request_limit' ] )
@@ -44,7 +44,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
4444
4545 test 'ping with valid token' do
4646 token = JwtWrapper . encode ( user_id : users ( :yo ) . id )
47- get '/api/v1/ping' , headers : { ' Authorization' : "Bearer #{ token } " }
47+ get '/api/v1/ping' , headers : { Authorization : "Bearer #{ token } " }
4848 assert_equal ( 200 , response . status )
4949 assert_equal ( 'pong' , JSON . parse ( response . body ) )
5050 end
@@ -53,7 +53,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
5353 token = JwtWrapper . encode ( user_id : users ( :yo ) . id )
5454 VCR . use_cassette ( 'record 001714562' ) do
5555 get '/api/v1/record/001714562' ,
56- headers : { ' Authorization' : "Bearer #{ token } " }
56+ headers : { Authorization : "Bearer #{ token } " }
5757 assert_equal ( 200 , response . status )
5858 json = JSON . parse ( response . body )
5959 assert_equal ( '001714562' , json [ 'id' ] )
@@ -65,7 +65,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
6565 token = JwtWrapper . encode ( user_id : users ( :yo ) . id )
6666 VCR . use_cassette ( 'record asdf' ) do
6767 get '/api/v1/record/asdf' ,
68- headers : { ' Authorization' : "Bearer #{ token } " }
68+ headers : { Authorization : "Bearer #{ token } " }
6969 assert_equal ( 404 , response . status )
7070 end
7171 end
@@ -74,47 +74,47 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
7474 token = JwtWrapper . encode ( user_id : users ( :yo ) . id )
7575 VCR . use_cassette ( 'record period' ) do
7676 get '/api/v1/record/MIT:archivespace:MC.0044' ,
77- headers : { ' Authorization' : "Bearer #{ token } " }
78- assert_equal ( 200 , response . status )
79- json = JSON . parse ( response . body )
80- assert_equal ( 'MIT:archivespace:MC.0044' , json [ 'id' ] )
77+ headers : { Authorization : "Bearer #{ token } " }
78+ assert_equal ( 200 , response . status )
79+ json = JSON . parse ( response . body )
80+ assert_equal ( 'MIT:archivespace:MC.0044' , json [ 'id' ] )
8181 end
8282 end
8383
8484 test 'pagination' do
8585 token = JwtWrapper . encode ( user_id : users ( :yo ) . id )
8686 VCR . use_cassette ( 'pagination' ) do
8787 get '/api/v1/search?q=marvel' ,
88- headers : { ' Authorization' : "Bearer #{ token } " }
88+ headers : { Authorization : "Bearer #{ token } " }
8989 assert_equal ( 200 , response . status )
9090 json = JSON . parse ( response . body )
9191 assert_equal ( 394 , json [ 'hits' ] )
9292 assert_equal ( '002312360' , json [ 'results' ] [ 0 ] [ 'id' ] )
9393
9494 get '/api/v1/search?q=marvel&page=2' ,
95- headers : { ' Authorization' : "Bearer #{ token } " }
95+ headers : { Authorization : "Bearer #{ token } " }
9696 assert_equal ( 200 , response . status )
9797 json = JSON . parse ( response . body )
9898 assert_equal ( 394 , json [ 'hits' ] )
9999 assert_equal ( '002611432' , json [ 'results' ] [ 0 ] [ 'id' ] )
100100
101101 get '/api/v1/search?q=marvel&page=10' ,
102- headers : { ' Authorization' : "Bearer #{ token } " }
102+ headers : { Authorization : "Bearer #{ token } " }
103103 assert_equal ( 200 , response . status )
104104 json = JSON . parse ( response . body )
105105 assert_equal ( 394 , json [ 'hits' ] )
106106 assert_equal ( '002602394' , json [ 'results' ] [ 0 ] [ 'id' ] )
107107
108108 get '/api/v1/search?q=marvel&page=25' ,
109- headers : { ' Authorization' : "Bearer #{ token } " }
109+ headers : { Authorization : "Bearer #{ token } " }
110110 assert_equal ( 200 , response . status )
111111 json = JSON . parse ( response . body )
112112 assert_equal ( 394 , json [ 'hits' ] )
113113 assert_equal ( 'Invalid page parameter: requested page past last result' ,
114114 json [ 'error' ] )
115115
116116 get '/api/v1/search?q=marvel&page=400' ,
117- headers : { ' Authorization' : "Bearer #{ token } " }
117+ headers : { Authorization : "Bearer #{ token } " }
118118 assert_equal ( 400 , response . status )
119119 json = JSON . parse ( response . body )
120120 assert_nil ( json [ 'hits' ] )
@@ -127,21 +127,21 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
127127 token = JwtWrapper . encode ( user_id : users ( :yo ) . id )
128128 VCR . use_cassette ( 'filtering multiple values' ) do
129129 get '/api/v1/search?q=marvel' ,
130- headers : { ' Authorization' : "Bearer #{ token } " }
130+ headers : { Authorization : "Bearer #{ token } " }
131131 assert_equal ( 200 , response . status )
132132 json = JSON . parse ( response . body )
133133 assert_equal ( 394 , json [ 'hits' ] )
134134 assert_equal ( '002312360' , json [ 'results' ] [ 0 ] [ 'id' ] )
135135
136136 get '/api/v1/search?q=marvel&subject[]=Graphic%20Novels.' ,
137- headers : { ' Authorization' : "Bearer #{ token } " }
137+ headers : { Authorization : "Bearer #{ token } " }
138138 assert_equal ( 200 , response . status )
139139 json = JSON . parse ( response . body )
140140 assert_equal ( 20 , json [ 'hits' ] )
141141 assert_equal ( '002295630' , json [ 'results' ] [ 0 ] [ 'id' ] )
142142
143143 get '/api/v1/search?q=marvel&subject[]=Graphic%20Novels.&subject[]=science%20fiction%20comic%20books,%20strips,%20etc.' ,
144- headers : { ' Authorization' : "Bearer #{ token } " }
144+ headers : { Authorization : "Bearer #{ token } " }
145145 assert_equal ( 200 , response . status )
146146 json = JSON . parse ( response . body )
147147 assert_equal ( 11 , json [ 'hits' ] )
@@ -153,14 +153,14 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
153153 token = JwtWrapper . encode ( user_id : users ( :yo ) . id )
154154 VCR . use_cassette ( 'filtering single value' ) do
155155 get '/api/v1/search?q=marvel' ,
156- headers : { ' Authorization' : "Bearer #{ token } " }
156+ headers : { Authorization : "Bearer #{ token } " }
157157 assert_equal ( 200 , response . status )
158158 json = JSON . parse ( response . body )
159159 assert_equal ( 394 , json [ 'hits' ] )
160160 assert_equal ( '002312360' , json [ 'results' ] [ 0 ] [ 'id' ] )
161161
162162 get '/api/v1/search?q=marvel&literary_form=fiction' ,
163- headers : { ' Authorization' : "Bearer #{ token } " }
163+ headers : { Authorization : "Bearer #{ token } " }
164164 assert_equal ( 200 , response . status )
165165 json = JSON . parse ( response . body )
166166 assert_equal ( 227 , json [ 'hits' ] )
0 commit comments