summaryrefslogtreecommitdiff
path: root/spec/controllers/projects/branches_controller_spec.rb
diff options
context:
space:
mode:
authorPeter Leitzen <pleitzen@gitlab.com>2019-07-16 08:03:49 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2019-07-16 08:03:49 +0000
commit7b87ed14991737930eb8f353feec9e6c8af6c1ac (patch)
treea5c22c297184ed7b00156d3a9a7f3edf19c19a41 /spec/controllers/projects/branches_controller_spec.rb
parente38a3bba1b32754a11e805093f306135beee55dd (diff)
downloadgitlab-ce-7b87ed14991737930eb8f353feec9e6c8af6c1ac.tar.gz
Cleanup usages of `JSON.parse` in specs
Prefer `json_response` where applicable.
Diffstat (limited to 'spec/controllers/projects/branches_controller_spec.rb')
-rw-r--r--spec/controllers/projects/branches_controller_spec.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/spec/controllers/projects/branches_controller_spec.rb b/spec/controllers/projects/branches_controller_spec.rb
index b30966e70a7..f5bcea4a097 100644
--- a/spec/controllers/projects/branches_controller_spec.rb
+++ b/spec/controllers/projects/branches_controller_spec.rb
@@ -495,10 +495,8 @@ describe Projects::BranchesController do
search: 'master'
}
- parsed_response = JSON.parse(response.body)
-
- expect(parsed_response.length).to eq 1
- expect(parsed_response.first).to eq 'master'
+ expect(json_response.length).to eq 1
+ expect(json_response.first).to eq 'master'
end
end
@@ -591,8 +589,7 @@ describe Projects::BranchesController do
end
it 'returns the commit counts behind and ahead of default branch' do
- parsed_response = JSON.parse(response.body)
- expect(parsed_response).to eq(
+ expect(json_response).to eq(
"fix" => { "behind" => 29, "ahead" => 2 },
"branch-merged" => { "behind" => 1, "ahead" => 0 },
"add-pdf-file" => { "behind" => 0, "ahead" => 3 }