Skip to content

Commit 488c2d4

Browse files
committed
Fix API sanitize helper missing error
1 parent 9379fd2 commit 488c2d4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/controllers/api/v3/application_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module V3
77
class ApplicationController < ActionController::Base
88
include ActionController::Caching
99
include ActionView::Helpers::OutputSafetyHelper
10+
include ActionView::Helpers::SanitizeHelper
1011
include ApplicationHelper
1112
include ::ApplicationController::CurrentInfo
1213

test/controllers/api/users_test.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,23 @@
3939

4040
describe "GET /api/v3/users/:login.json" do
4141
it "should get user details with list of topics" do
42-
user = create(:user, name: "test user", login: "test_user", email: "foobar@gmail.com", email_public: true)
42+
user = create(:user, name: "test user", login: "test_user", email: "foobar@gmail.com", bio: "hello world", email_public: true)
4343
get "/api/v3/users/test_user.json"
4444
assert_equal 200, response.status
4545
fields = %w[id name login email avatar_url location company twitter github website bio tagline
4646
topics_count replies_count following_count followers_count favorites_count
4747
level level_name]
4848

4949
assert_has_keys json["user"], *fields
50-
fields.reject { |f| f == "avatar_url" }.each do |field|
50+
fields.reject { |f| f.in? %w[avatar_url bio] }.each do |field|
5151
val = user.send(field)
5252
if val.nil?
5353
assert_nil json["user"][field]
5454
else
5555
assert_equal val, json["user"][field]
5656
end
5757
end
58+
assert_equal "<p>hello world</p>", json["user"]["bio"]
5859
assert_has_keys json["meta"], "blocked", "followed"
5960
end
6061

0 commit comments

Comments
 (0)