diff options
author | Stan Hu <stanhu@gmail.com> | 2019-03-19 07:07:32 +0300 |
---|---|---|
committer | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-03-19 16:57:14 +0300 |
commit | c7491c0b764b11eadf9a55735b44f45100353182 (patch) | |
tree | 4a781aede5829fa1631495773e7c570cb78be759 /spec | |
parent | ff84662fb089f3320b8537922727863e2cdb0d8c (diff) |
Merge branch 'fix-projects-partial-locals' into 'master'
Fix undefined variable error on json project views
See merge request gitlab-org/gitlab-ce!26297
(cherry picked from commit 3c5a81cb83e6022530e53b1b6cdedf94c92d980e)
585fcfb9 Fix undefined variable error on json project views
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/admin/projects_controller_spec.rb | 10 | ||||
-rw-r--r-- | spec/controllers/dashboard/projects_controller_spec.rb | 26 | ||||
-rw-r--r-- | spec/controllers/explore/projects_controller_spec.rb | 30 |
3 files changed, 66 insertions, 0 deletions
diff --git a/spec/controllers/admin/projects_controller_spec.rb b/spec/controllers/admin/projects_controller_spec.rb index 8166657f674..4caf8b46519 100644 --- a/spec/controllers/admin/projects_controller_spec.rb +++ b/spec/controllers/admin/projects_controller_spec.rb @@ -43,6 +43,16 @@ describe Admin::ProjectsController do end end + describe 'GET /projects.json' do + render_views + + before do + get :index, format: :json + end + + it { is_expected.to respond_with(:success) } + end + describe 'GET /projects/:id' do render_views diff --git a/spec/controllers/dashboard/projects_controller_spec.rb b/spec/controllers/dashboard/projects_controller_spec.rb index 2975205e09c..649441f4917 100644 --- a/spec/controllers/dashboard/projects_controller_spec.rb +++ b/spec/controllers/dashboard/projects_controller_spec.rb @@ -2,4 +2,30 @@ require 'spec_helper' describe Dashboard::ProjectsController do it_behaves_like 'authenticates sessionless user', :index, :atom + + context 'json requests' do + render_views + + let(:user) { create(:user) } + + before do + sign_in(user) + end + + describe 'GET /projects.json' do + before do + get :index, format: :json + end + + it { is_expected.to respond_with(:success) } + end + + describe 'GET /starred.json' do + before do + get :starred, format: :json + end + + it { is_expected.to respond_with(:success) } + end + end end diff --git a/spec/controllers/explore/projects_controller_spec.rb b/spec/controllers/explore/projects_controller_spec.rb index d57367e931e..7e20ddca249 100644 --- a/spec/controllers/explore/projects_controller_spec.rb +++ b/spec/controllers/explore/projects_controller_spec.rb @@ -1,6 +1,36 @@ require 'spec_helper' describe Explore::ProjectsController do + describe 'GET #index.json' do + render_views + + before do + get :index, format: :json + end + + it { is_expected.to respond_with(:success) } + end + + describe 'GET #trending.json' do + render_views + + before do + get :trending, format: :json + end + + it { is_expected.to respond_with(:success) } + end + + describe 'GET #starred.json' do + render_views + + before do + get :starred, format: :json + end + + it { is_expected.to respond_with(:success) } + end + describe 'GET #trending' do context 'sorting by update date' do let(:project1) { create(:project, :public, updated_at: 3.days.ago) } |