Skip to content

Commit 27681ac

Browse files
committed
Ruby: Move ActionController tests to own directory
1 parent c70f3d3 commit 27681ac

File tree

9 files changed

+380
-410
lines changed

9 files changed

+380
-410
lines changed

ruby/ql/test/library-tests/frameworks/ActionController.expected

Lines changed: 0 additions & 410 deletions
This file was deleted.

ruby/ql/test/library-tests/frameworks/action_controller/ActionController.expected

Lines changed: 272 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
class CommentsController < ApplicationController
2+
def index
3+
request.params
4+
request.parameters
5+
request.GET
6+
request.POST
7+
request.query_parameters
8+
request.request_parameters
9+
request.filtered_parameters
10+
11+
response.body = "some content"
12+
13+
response.status = 200
14+
15+
response.header["Content-Type"] = "text/html"
16+
response.set_header("Content-Length", 100)
17+
response.headers["X-Custom-Header"] = "hi"
18+
response["X-Another-Custom-Header"] = "yes"
19+
response.add_header "X-Yet-Another", "indeed"
20+
21+
response.send_file("my-file.ext")
22+
23+
response.request
24+
25+
response.location = "http://..." # relevant for url redirect query
26+
response.cache_control = "value"
27+
response._cache_control = "value"
28+
response.etag = "value"
29+
response.charset = "value" # sets the charset part of the content-type header
30+
response.content_type = "value" # sets the main part of the content-type header
31+
32+
response.date = Date.today
33+
response.last_modified = Date.yesterday
34+
response.weak_etag = "value"
35+
response.strong_etag = "value"
36+
end
37+
38+
def show
39+
end
40+
end
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
require 'json'
2+
3+
class BarsController < ApplicationController
4+
5+
def index
6+
render template: "foo/bars/index"
7+
end
8+
9+
def show_debug
10+
user_info = JSON.load cookies[:user_info]
11+
puts "User: #{user_info['name']}"
12+
13+
@user_website = params[:website]
14+
dt = params[:text]
15+
rendered = render_to_string "foo/bars/show", locals: { display_text: dt, safe_text: "hello" }
16+
puts rendered
17+
redirect_to action: "show"
18+
end
19+
20+
def show
21+
@user_website = params[:website]
22+
dt = params[:text]
23+
render "foo/bars/show", locals: { display_text: dt, safe_text: "hello" }
24+
end
25+
26+
def go_back
27+
redirect_back_or_to action: "index"
28+
end
29+
30+
def go_back_2
31+
redirect_back fallback_location: { action: "index" }
32+
end
33+
34+
def show_2
35+
render json: { some: "data" }
36+
body = render_to_string @user, content_type: "application/json"
37+
rescue => e
38+
render e.backtrace, content_type: "text/plain"
39+
end
40+
41+
private
42+
43+
def unreachable_action
44+
render "show"
45+
end
46+
end
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class PhotosController < ApplicationController
2+
def show
3+
end
4+
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class PostsController < ApplicationController
2+
def index
3+
end
4+
5+
def show
6+
end
7+
8+
def upvote
9+
end
10+
end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class TagsController < ActionController::Metal
2+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Users
2+
class NotificationsController < ApplicationController
3+
def mark_as_read
4+
end
5+
end
6+
end

0 commit comments

Comments
 (0)