Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OHR Support
Manage
Activity
Members
Labels
Plan
Issues
97
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
OHR Support
Commits
1aa20b17
Commit
1aa20b17
authored
14 years ago
by
Eric Davis
Browse files
Options
Downloads
Patches
Plain Diff
[
#302
] Protect ApplicationController methods so they are not considered actions
parent
2c67f610
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/application_controller.rb
+3
-0
3 additions, 0 deletions
app/controllers/application_controller.rb
test/functional/application_controller_test.rb
+13
-13
13 additions, 13 deletions
test/functional/application_controller_test.rb
with
16 additions
and
13 deletions
app/controllers/application_controller.rb
+
3
−
0
View file @
1aa20b17
...
...
@@ -19,6 +19,9 @@ require 'uri'
require
'cgi'
class
ApplicationController
<
ActionController
::
Base
protected
include
Redmine
::
I18n
layout
'base'
...
...
This diff is collapsed.
Click to expand it.
test/functional/application_controller_test.rb
+
13
−
13
View file @
1aa20b17
...
...
@@ -47,55 +47,55 @@ class ApplicationControllerTest < ActionController::TestCase
context
"test_api_offset_and_limit"
do
context
"without params"
do
should
"return 0, 25"
do
assert_equal
[
0
,
25
],
@controller
.
api_offset_and_limit
(
{})
assert_equal
[
0
,
25
],
@controller
.
send
(
:
api_offset_and_limit
,
{})
end
end
context
"with limit"
do
should
"return 0, limit"
do
assert_equal
[
0
,
30
],
@controller
.
api_offset_and_limit
(
{
:limit
=>
30
})
assert_equal
[
0
,
30
],
@controller
.
send
(
:
api_offset_and_limit
,
{
:limit
=>
30
})
end
should
"not exceed 100"
do
assert_equal
[
0
,
100
],
@controller
.
api_offset_and_limit
(
{
:limit
=>
120
})
assert_equal
[
0
,
100
],
@controller
.
send
(
:
api_offset_and_limit
,
{
:limit
=>
120
})
end
should
"not be negative"
do
assert_equal
[
0
,
25
],
@controller
.
api_offset_and_limit
(
{
:limit
=>
-
10
})
assert_equal
[
0
,
25
],
@controller
.
send
(
:
api_offset_and_limit
,
{
:limit
=>
-
10
})
end
end
context
"with offset"
do
should
"return offset, 25"
do
assert_equal
[
10
,
25
],
@controller
.
api_offset_and_limit
(
{
:offset
=>
10
})
assert_equal
[
10
,
25
],
@controller
.
send
(
:
api_offset_and_limit
,
{
:offset
=>
10
})
end
should
"not be negative"
do
assert_equal
[
0
,
25
],
@controller
.
api_offset_and_limit
(
{
:offset
=>
-
10
})
assert_equal
[
0
,
25
],
@controller
.
send
(
:
api_offset_and_limit
,
{
:offset
=>
-
10
})
end
context
"and limit"
do
should
"return offset, limit"
do
assert_equal
[
10
,
50
],
@controller
.
api_offset_and_limit
(
{
:offset
=>
10
,
:limit
=>
50
})
assert_equal
[
10
,
50
],
@controller
.
send
(
:
api_offset_and_limit
,
{
:offset
=>
10
,
:limit
=>
50
})
end
end
end
context
"with page"
do
should
"return offset, 25"
do
assert_equal
[
0
,
25
],
@controller
.
api_offset_and_limit
(
{
:page
=>
1
})
assert_equal
[
50
,
25
],
@controller
.
api_offset_and_limit
(
{
:page
=>
3
})
assert_equal
[
0
,
25
],
@controller
.
send
(
:
api_offset_and_limit
,
{
:page
=>
1
})
assert_equal
[
50
,
25
],
@controller
.
send
(
:
api_offset_and_limit
,
{
:page
=>
3
})
end
should
"not be negative"
do
assert_equal
[
0
,
25
],
@controller
.
api_offset_and_limit
(
{
:page
=>
0
})
assert_equal
[
0
,
25
],
@controller
.
api_offset_and_limit
(
{
:page
=>
-
2
})
assert_equal
[
0
,
25
],
@controller
.
send
(
:
api_offset_and_limit
,
{
:page
=>
0
})
assert_equal
[
0
,
25
],
@controller
.
send
(
:
api_offset_and_limit
,
{
:page
=>
-
2
})
end
context
"and limit"
do
should
"return offset, limit"
do
assert_equal
[
0
,
100
],
@controller
.
api_offset_and_limit
(
{
:page
=>
1
,
:limit
=>
100
})
assert_equal
[
200
,
100
],
@controller
.
api_offset_and_limit
(
{
:page
=>
3
,
:limit
=>
100
})
assert_equal
[
0
,
100
],
@controller
.
send
(
:
api_offset_and_limit
,
{
:page
=>
1
,
:limit
=>
100
})
assert_equal
[
200
,
100
],
@controller
.
send
(
:
api_offset_and_limit
,
{
:page
=>
3
,
:limit
=>
100
})
end
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment