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
if collectedDesc.index(desc).nil?
collectedDesc.push(desc)
boolean = false
false # return this value
else
boolean = true
true # return this value
end
end
elsif topic1id && !topic1id.empty?

View file

@ -250,7 +250,7 @@ class MapsController < ApplicationController
end
removed = @map.collaborators.select { |user| !userIds.include?(user.id.to_s) }.map(&:id)
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)
MapMailer.invite_to_edit_email(@map, current_user, user).deliver_later
end

View file

@ -1,21 +1,6 @@
module DeviseHelper
def devise_error_messages!
message = 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
resource.errors.to_a[0]
end
def devise_error_messages?

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,9 +2,9 @@ require 'rails_helper'
RSpec.describe Token, type: :model do
context '#generate_token' do
subject (:token) { Token.new }
subject(:token) { Token.new }
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