rubocop -a
This commit is contained in:
@@ -9,7 +9,7 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
# calculate how long a user needed for a form input, ussually we just
|
# calculate how long a user needed for a form input, ussually we just
|
||||||
def input_to_fast?
|
def input_to_fast?
|
||||||
fail 'session[:form_timestamp] not set' unless session[:form_timestamp]
|
raise 'session[:form_timestamp] not set' unless session[:form_timestamp]
|
||||||
duration = Time.now - session[:form_timestamp].to_time
|
duration = Time.now - session[:form_timestamp].to_time
|
||||||
duration < INPUT_TIMEOUT
|
duration < INPUT_TIMEOUT
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class CitiesAutocompleteController < ApplicationController
|
|||||||
def index
|
def index
|
||||||
@cities = CSV.read Rails.root.join('db', 'plz_ch.csv')
|
@cities = CSV.read Rails.root.join('db', 'plz_ch.csv')
|
||||||
query = ActionController::Base.helpers.sanitize(params[:query])
|
query = ActionController::Base.helpers.sanitize(params[:query])
|
||||||
@cities = @cities.select { |city| city.first =~ /#{query}/i || city.last =~ /#{query}/i }
|
@cities = @cities.select { |city| city.first =~ /#{query}/i || city.last =~ /#{query}/i }
|
||||||
@cities = @cities.map { |city| { plz: city.first, city: city.last } }
|
@cities = @cities.map { |city| { plz: city.first, city: city.last } }
|
||||||
|
|
||||||
render json: @cities.uniq
|
render json: @cities.uniq
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ class MailChimpBatchUpdate
|
|||||||
subscribers = []
|
subscribers = []
|
||||||
|
|
||||||
Supporter.each_with_index do |supporter, index|
|
Supporter.each_with_index do |supporter, index|
|
||||||
subscribers.push(subscriber supporter)
|
subscribers.push(subscriber(supporter))
|
||||||
if index.modulo(20) == 0
|
if index.modulo(20).zero?
|
||||||
batch_subscribe(subscribers)
|
batch_subscribe(subscribers)
|
||||||
subscribers = []
|
subscribers = []
|
||||||
end
|
end
|
||||||
@@ -32,7 +32,8 @@ class MailChimpBatchUpdate
|
|||||||
'MEMBERSHIP' => supporter.li_membership.to_s,
|
'MEMBERSHIP' => supporter.li_membership.to_s,
|
||||||
'AGE' => supporter.age_category,
|
'AGE' => supporter.age_category,
|
||||||
'LANG' => supporter.language,
|
'LANG' => supporter.language,
|
||||||
'ZIP' => supporter.zip } }
|
'ZIP' => supporter.zip
|
||||||
|
} }
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_unsubscibed
|
def update_unsubscibed
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ describe ApplicationHelper do
|
|||||||
describe '.title' do
|
describe '.title' do
|
||||||
it 'sets content for :title' do
|
it 'sets content for :title' do
|
||||||
helper.title 'test'
|
helper.title 'test'
|
||||||
expect(view.content_for :title).to eq 'test'
|
expect(view.content_for(:title)).to eq 'test'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ describe Supporter do
|
|||||||
|
|
||||||
describe '.counter' do
|
describe '.counter' do
|
||||||
it 'counts only from a certain number on' do
|
it 'counts only from a certain number on' do
|
||||||
allow(Supporter).to receive(:count) { 12 }
|
allow(Supporter).to receive(:count) { 12 }
|
||||||
|
|
||||||
expect(Supporter.counter).to eq Supporter::COUNTER_START
|
expect(Supporter.counter).to eq Supporter::COUNTER_START
|
||||||
|
|
||||||
allow(Supporter).to receive(:count) { Supporter::COUNTER_START + 12 }
|
allow(Supporter).to receive(:count) { Supporter::COUNTER_START + 12 }
|
||||||
|
|
||||||
expect(Supporter.counter).to eq Supporter::COUNTER_START + 12
|
expect(Supporter.counter).to eq Supporter::COUNTER_START + 12
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user