@@ -14,14 +14,16 @@ def setup
1414 "name" : "Falko" ,
1515 "description" : "Some project description 1." ,
1616 "user_id" : @user . id ,
17- "is_project_from_github" : true
17+ "is_project_from_github" : true ,
18+ "github_slug" : "alaxalves/Falko"
1819 )
1920
2021 @project2 = Project . create (
2122 "name" : "Falko" ,
2223 "description" : "Some project description 2." ,
2324 "user_id" : @user . id ,
24- "is_project_from_github" : false
25+ "is_project_from_github" : false ,
26+ "github_slug" : "alaxalves/LabBancos"
2527 )
2628
2729 @token = AuthenticateUser . call ( @user . email , @user . password )
@@ -221,6 +223,32 @@ def mock.organization_repositories(login)
221223 end
222224 end
223225
226+ test "should receive an numeric score" do
227+ @token = AuthenticateUser . call ( @user . email , @user . password )
228+ codeclimate_response = '{
229+ "data": [{
230+ "id": "696a76232df2736347000001",
231+ "type": "repos",
232+ "attributes": {
233+ "analysis_version": 3385,
234+ "badge_token": "16096d266f46b7c68dd4",
235+ "branch": "master",
236+ "created_at": "2017-07-15T20:08:03.732Z",
237+ "github_slug": "twinpeaks\/ranchorosa",
238+ "human_name": "ranchorosa",
239+ "last_activity_at": "2017-07-15T20:09:41.846Z",
240+ "score": 2.92
241+ }
242+ }]
243+ }'
244+
245+ RestClient . stub :get , codeclimate_response do
246+ get "/projects/#{ @project . id } /gpa" , headers : { Authorization : @token . result }
247+ assert_response :success
248+ assert response . parsed_body == 2.92
249+ end
250+ end
251+
224252 test "should not import a project from github if the is_project_from_github is invalid" do
225253 post "/users/#{ @user . id } /projects" , params : {
226254 "project" : {
0 commit comments