Feature #19828 » 19828-reset-api-filter-on-project-status-v2.diff
| app/controllers/projects_controller.rb | ||
|---|---|---|
|
@projects = scope.to_a
|
||
|
}
|
||
|
format.api {
|
||
|
if params[:status]
|
||
|
scope = scope.status(params[:status])
|
||
|
end
|
||
|
@offset, @limit = api_offset_and_limit
|
||
|
@project_count = scope.count
|
||
|
@projects = scope.offset(@offset).limit(@limit).to_a
|
||
| test/integration/api_test/projects_test.rb | ||
|---|---|---|
|
assert json['projects'].first.has_key?('id')
|
||
|
end
|
||
|
test "GET /projects.json with status=1 should return active projects" do
|
||
|
Project.find_by_name('eCookbook').update_attribute :status, Project::STATUS_CLOSED
|
||
|
get '/projects.json?status=1'
|
||
|
assert_response :success
|
||
|
json = ActiveSupport::JSON.decode(response.body)
|
||
|
assert json['projects'].any?
|
||
|
assert json['projects'].all? {|p| p['status'] == 1}
|
||
|
end
|
||
|
test "GET /projects.xml with include=issue_categories should return categories" do
|
||
|
get '/projects.xml?include=issue_categories'
|
||
|
assert_response :success
|
||
- « Previous
- 1
- 2
- Next »