Fix Rubocop lints (#5155)

This commit is contained in:
Anna Buianova 2019-12-19 18:09:37 +03:00 committed by Mac Siri
parent d5414eeac7
commit dcfa6d29b8
5 changed files with 5 additions and 9 deletions

View file

@ -92,10 +92,8 @@ class CommentsController < ApplicationController
ancestry: @comment.ancestry)[1])
@comment.destroy
render json: { status: "comment already exists" }
return
else
render json: { status: "errors" }
return
end
end

View file

@ -44,7 +44,6 @@ class StoriesController < ApplicationController
Organization.find_by("old_slug = ? OR old_old_slug = ?", potential_username, potential_username)
if user_or_org.present?
redirect_to user_or_org.path
return
else
not_found
end

View file

@ -103,7 +103,7 @@ Rails.application.configure do
redis_url = ENV["REDISCLOUD_URL"]
redis_url ||= ApplicationConfig["REDIS_URL"]
DEFAULT_EXPIRATION = 24.hours.to_i.freeze
config.cache_store = :redis_store, ENV["REDIS_URL"], { expires_in: DEFAULT_EXPIRATION }
config.cache_store = :redis_store, redis_url, { expires_in: DEFAULT_EXPIRATION }
config.app_domain = ENV["APP_DOMAIN"]

View file

@ -4,7 +4,6 @@ RSpec.describe CommentPolicy, type: :policy do
subject(:comment_policy) { described_class.new(user, comment) }
let(:article) { build_stubbed(:article) }
let(:comment) { build_stubbed(:comment, commentable: article) }
let!(:comment) { create(:comment, commentable: create(:podcast_episode)) }
let(:valid_attributes_for_create) do

View file

@ -10,7 +10,7 @@ RSpec.describe "internal/organizations", type: :request do
end
describe "GETS /internal/organizations" do
let(:organizations) { Organization.all.map { |o| CGI.escapeHTML(o.name) } }
let(:organizations) { Organization.pluck(:name).map { |n| CGI.escapeHTML(n) } }
let(:another_organization) { create(:organization, name: "T-800") }
it "lists all organizations" do
@ -20,15 +20,15 @@ RSpec.describe "internal/organizations", type: :request do
it "allows searching" do
get "/internal/organizations?search=#{organization.name}"
expect(response.body).to include(organization.name)
expect(response.body).not_to include(another_organization.name)
expect(response.body).to include(CGI.escapeHTML(organization.name))
expect(response.body).not_to include(CGI.escapeHTML(another_organization.name))
end
end
describe "GET /internal/orgnaizations/:id" do
it "renders the correct organization" do
get "/internal/organizations/#{organization.id}"
expect(response.body).to include(organization.name)
expect(response.body).to include(CGI.escapeHTML(organization.name))
end
end
end