rubocop lint warnings

This commit is contained in:
Devin Howard 2016-06-30 12:03:31 +08:00
parent ed47fbf5be
commit f01aed9d37
9 changed files with 14 additions and 53 deletions

View file

@ -160,9 +160,9 @@ class MainController < ApplicationController
desc = s.desc.nil? || s.desc == '' ? '' : s.desc.strip desc = s.desc.nil? || s.desc == '' ? '' : s.desc.strip
if collectedDesc.index(desc).nil? if collectedDesc.index(desc).nil?
collectedDesc.push(desc) collectedDesc.push(desc)
boolean = false false # return this value
else else
boolean = true true # return this value
end end
end end
elsif topic1id && !topic1id.empty? elsif topic1id && !topic1id.empty?

View file

@ -250,7 +250,7 @@ class MapsController < ApplicationController
end end
removed = @map.collaborators.select { |user| !userIds.include?(user.id.to_s) }.map(&:id) removed = @map.collaborators.select { |user| !userIds.include?(user.id.to_s) }.map(&:id)
added.each do |uid| added.each do |uid|
um = UserMap.create(user_id: uid.to_i, map_id: @map.id) UserMap.create(user_id: uid.to_i, map_id: @map.id)
user = User.find(uid.to_i) user = User.find(uid.to_i)
MapMailer.invite_to_edit_email(@map, current_user, user).deliver_later MapMailer.invite_to_edit_email(@map, current_user, user).deliver_later
end end

View file

@ -1,21 +1,6 @@
module DeviseHelper module DeviseHelper
def devise_error_messages! def devise_error_messages!
message = resource.errors.to_a[0] resource.errors.to_a[0]
# return "" if resource.errors.empty?
# messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
# sentence = I18n.t("errors.messages.not_saved",
# :count => resource.errors.count,
# :resource => resource.class.model_name.human.downcase)
# html = <<-HTML
# <div id="error_explanation">
# <h2>#{sentence}</h2>
# <ul>#{messages}</ul>
# </div>
# HTML
# html.html_safe
end end
def devise_error_messages? def devise_error_messages?

View file

@ -7,12 +7,4 @@ class Events::ConversationStartedOnMap < Event
map: map, map: map,
user: user) user: user)
end end
private
# def notify_users!
# unless comment_vote.user == comment_vote.comment_user
# notify!(comment_vote.comment_user)
# end
# end
end end

View file

@ -7,12 +7,4 @@ class Events::NewMapping < Event
map: mapping.map, map: mapping.map,
user: user) user: user)
end end
private
# def notify_users!
# unless comment_vote.user == comment_vote.comment_user
# notify!(comment_vote.comment_user)
# end
# end
end end

View file

@ -7,12 +7,4 @@ class Events::UserPresentOnMap < Event
map: map, map: map,
user: user) user: user)
end end
private
# def notify_users!
# unless comment_vote.user == comment_vote.comment_user
# notify!(comment_vote.comment_user)
# end
# end
end end

View file

@ -4,13 +4,13 @@ class WebhookService
HTTParty.post webhook.uri, body: payload_for(webhook, event), headers: webhook.headers HTTParty.post webhook.uri, body: payload_for(webhook, event), headers: webhook.headers
end end
private class << self
def payload_for(webhook, event)
def self.payload_for(webhook, event)
WebhookSerializer.new(webhook_object_for(webhook, event), root: false).to_json WebhookSerializer.new(webhook_object_for(webhook, event), root: false).to_json
end end
def self.webhook_object_for(webhook, event) def webhook_object_for(webhook, event)
"Webhooks::#{webhook.kind.classify}::#{event.kind.classify}".constantize.new(event) "Webhooks::#{webhook.kind.classify}::#{event.kind.classify}".constantize.new(event)
end end
end
end end

View file

@ -6,7 +6,7 @@ namespace :heroku do
RAILS_ENV = 'production'.freeze RAILS_ENV = 'production'.freeze
Rake::Task[:environment].invoke Rake::Task[:environment].invoke
list = Rails.configuration.gems.collect do |g| list = Rails.configuration.gems.collect do |g|
command, *options = g.send(:install_command) _command, *options = g.send(:install_command)
options.join(' ') + "\n" options.join(' ') + "\n"
end end

View file

@ -2,9 +2,9 @@ require 'rails_helper'
RSpec.describe Token, type: :model do RSpec.describe Token, type: :model do
context '#generate_token' do context '#generate_token' do
subject (:token) { Token.new } subject(:token) { Token.new }
it 'should generate an alphanumeric token of 32 characters' do it 'should generate an alphanumeric token of 32 characters' do
expect(token.send(:generate_token)).to match /^[a-zA-Z0-9]{32}$/ expect(token.send(:generate_token)).to match(/^[a-zA-Z0-9]{32}$/)
end end
end end
end end