Skip to content
Snippets Groups Projects
Commit c7491c0b authored by Stan Hu's avatar Stan Hu Committed by GitLab Release Tools Bot
Browse files

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 3c5a81cb)

585fcfb9 Fix undefined variable error on json project views
parent ff84662f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -15,7 +15,7 @@ class Admin::ProjectsController < Admin::ApplicationController
format.html
format.json do
render json: {
html: view_to_html_string("admin/projects/_projects", locals: { projects: @projects })
html: view_to_html_string("admin/projects/_projects", projects: @projects)
}
end
end
Loading
Loading
Loading
Loading
@@ -26,7 +26,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
end
format.json do
render json: {
html: view_to_html_string("dashboard/projects/_projects", locals: { projects: @projects })
html: view_to_html_string("dashboard/projects/_projects", projects: @projects)
}
end
end
Loading
Loading
@@ -43,7 +43,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
format.html
format.json do
render json: {
html: view_to_html_string("dashboard/projects/_projects", locals: { projects: @projects })
html: view_to_html_string("dashboard/projects/_projects", projects: @projects)
}
end
end
Loading
Loading
Loading
Loading
@@ -15,7 +15,7 @@ class Explore::ProjectsController < Explore::ApplicationController
format.html
format.json do
render json: {
html: view_to_html_string("explore/projects/_projects", locals: { projects: @projects })
html: view_to_html_string("explore/projects/_projects", projects: @projects)
}
end
end
Loading
Loading
@@ -30,7 +30,7 @@ class Explore::ProjectsController < Explore::ApplicationController
format.html
format.json do
render json: {
html: view_to_html_string("explore/projects/_projects", locals: { projects: @projects })
html: view_to_html_string("explore/projects/_projects", projects: @projects)
}
end
end
Loading
Loading
@@ -44,7 +44,7 @@ class Explore::ProjectsController < Explore::ApplicationController
format.html
format.json do
render json: {
html: view_to_html_string("explore/projects/_projects", locals: { projects: @projects })
html: view_to_html_string("explore/projects/_projects", projects: @projects)
}
end
end
Loading
Loading
---
title: Fix undefined variable error on json project views
merge_request: 26297
author:
type: fixed
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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
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) }
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment