aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2013-12-06 10:38:55 +0600
committerStas Vilchik <vilchiks@gmail.com>2013-12-06 10:38:55 +0600
commitebf5df219a816533325a73915bfc682bcf591e42 (patch)
treedad44404d764edb560f1b5a77fcf7da679302fb1
parentf869a50482f3491408aa505578704fd725e052fd (diff)
downloadsonarqube-ebf5df219a816533325a73915bfc682bcf591e42.tar.gz
sonarqube-ebf5df219a816533325a73915bfc682bcf591e42.zip
Clean up mock controller
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/mock/example_controller.rb22
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/mock/users_groups_controller.rb35
2 files changed, 12 insertions, 45 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/mock/example_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/mock/example_controller.rb
index 144a772d416..0a3ce7fdd42 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/mock/example_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/mock/example_controller.rb
@@ -1,5 +1,5 @@
#
-# SonarQube, open source software quality management tool.
+# Sonar, entreprise quality control tool.
# Copyright (C) 2008-2013 SonarSource
# mailto:contact AT sonarsource DOT com
#
@@ -19,17 +19,19 @@
#
class Mock::ExampleController < Api::ApiController
- # GET /mock/example/search_groups
- def search_groups
+ # GET /mock/example/index
+ def index
+ # declare JSON response with ruby hash or array
+ render :json => JSON({'foo' => 'bar', 'an_integer' => 4})
+ end
+
+ # GET /mock/example/search
+ def search
+ # declare JSON response with string
render :json => <<RESPONSE
{
- "more": false,
- "results": [
- {"id": 1, "name": "sonar-administrators", "selected": false},
- {"id": 2, "name": "sonar-users", "selected": true}
- ]
+ "foo": "bar"
}
RESPONSE
- end
-
+ end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/mock/users_groups_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/mock/users_groups_controller.rb
deleted file mode 100644
index 889f6437123..00000000000
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/mock/users_groups_controller.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# SonarQube, open source software quality management tool.
-# Copyright (C) 2008-2013 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# SonarQube is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# SonarQube is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-class Mock::ExampleController < Api::ApiController
-
- # GET /mock/users_groups/search_groups
- def search_groups
- render :json => <<RESPONSE
- {
- "more": false,
- "results": [
- {"id": 1, "name": "sonar-administrators", "selected": false},
- {"id": 2, "name": "sonar-users", "selected": true}
- ]
- }
-RESPONSE
- end
-
-end