diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index bfc783e4e..27b209449 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -557,12 +557,6 @@ Style/RescueModifier:
- 'app/controllers/concerns/commentable_actions.rb'
- 'app/controllers/verification/sms_controller.rb'
-# Offense count: 66
-# Cop supports --auto-correct.
-# Configuration parameters: AllowForAlignment.
-Layout/SpaceAroundOperators:
- Enabled: false
-
# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
diff --git a/app/controllers/budgets/investments_controller.rb b/app/controllers/budgets/investments_controller.rb
index 469b09255..ea782d47c 100644
--- a/app/controllers/budgets/investments_controller.rb
+++ b/app/controllers/budgets/investments_controller.rb
@@ -93,7 +93,7 @@ module Budgets
def set_random_seed
if params[:order] == 'random' || params[:order].blank?
- params[:random_seed] ||= rand(99)/100.0
+ params[:random_seed] ||= rand(99) / 100.0
seed = Float(params[:random_seed]) rescue 0
Budget::Investment.connection.execute("select setseed(#{seed})")
else
diff --git a/app/controllers/management/budgets/investments_controller.rb b/app/controllers/management/budgets/investments_controller.rb
index 652d2b9a7..1fdf33911 100644
--- a/app/controllers/management/budgets/investments_controller.rb
+++ b/app/controllers/management/budgets/investments_controller.rb
@@ -20,7 +20,7 @@ class Management::Budgets::InvestmentsController < Management::BaseController
@investment.author = managed_user
if @investment.save
- notice= t('flash.actions.create.notice', resource_name: Budget::Investment.model_name.human, count: 1)
+ notice = t('flash.actions.create.notice', resource_name: Budget::Investment.model_name.human, count: 1)
redirect_to management_budget_investment_path(@budget, @investment), notice: notice
else
render :new
diff --git a/app/helpers/ballots_helper.rb b/app/helpers/ballots_helper.rb
index ece1be9fa..8bdc5f231 100644
--- a/app/helpers/ballots_helper.rb
+++ b/app/helpers/ballots_helper.rb
@@ -1,7 +1,7 @@
module BallotsHelper
def progress_bar_width(amount_available, amount_spent)
- (amount_spent/amount_available.to_f * 100).to_s + "%"
+ (amount_spent / amount_available.to_f * 100).to_s + "%"
end
end
\ No newline at end of file
diff --git a/app/helpers/embed_videos_helper.rb b/app/helpers/embed_videos_helper.rb
index cb077ef36..1034a7a59 100644
--- a/app/helpers/embed_videos_helper.rb
+++ b/app/helpers/embed_videos_helper.rb
@@ -11,7 +11,7 @@ module EmbedVideosHelper
if server == "Vimeo"
reg_exp = /vimeo.*(staffpicks\/|channels\/|videos\/|video\/|\/)([^#\&\?]*).*/
- src = "https://player.vimeo.com/video/"
+ src = "https://player.vimeo.com/video/"
elsif server == "YouTube"
reg_exp = /youtu.*(be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/
src = "https://www.youtube.com/embed/"
diff --git a/app/helpers/officing_helper.rb b/app/helpers/officing_helper.rb
index f5bdb26ea..8ee97cf52 100644
--- a/app/helpers/officing_helper.rb
+++ b/app/helpers/officing_helper.rb
@@ -13,7 +13,7 @@ module OfficingHelper
officer_assignments.each do |oa|
options << [oa.booth_assignment.booth.name.to_s, oa.id]
end
- options.sort! {|x, y| x[0]<=>y[0]}
+ options.sort! {|x, y| x[0] <=> y[0]}
options_for_select(options, params[:oa])
end
diff --git a/app/helpers/poll_recounts_helper.rb b/app/helpers/poll_recounts_helper.rb
index c47402163..60e3da6d7 100644
--- a/app/helpers/poll_recounts_helper.rb
+++ b/app/helpers/poll_recounts_helper.rb
@@ -9,7 +9,7 @@ module PollRecountsHelper
end
def booth_assignment_sum_final_recounts(ba)
- ba.final_recounts.any? ? ba.final_recounts.to_a.sum(&:count) :nil
+ ba.final_recounts.any? ? ba.final_recounts.to_a.sum(&:count) : nil
end
end
\ No newline at end of file
diff --git a/app/helpers/verification_helper.rb b/app/helpers/verification_helper.rb
index 62be1a5a8..44f921264 100644
--- a/app/helpers/verification_helper.rb
+++ b/app/helpers/verification_helper.rb
@@ -18,7 +18,7 @@ module VerificationHelper
data_to_mask = match[2]
email_provider = match[3]
- data_to_display + "*"*data_to_mask.size + "@" + email_provider
+ data_to_display + "*" * data_to_mask.size + "@" + email_provider
end
end
diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb
index 1460cf437..7ba0548e2 100644
--- a/app/models/budget/investment.rb
+++ b/app/models/budget/investment.rb
@@ -205,8 +205,8 @@ class Budget
end
def should_show_aside?
- (budget.selecting? && !unfeasible?) ||
- (budget.balloting? && feasible?) ||
+ (budget.selecting? && !unfeasible?) ||
+ (budget.balloting? && feasible?) ||
(budget.valuating? && !unfeasible?)
end
diff --git a/app/models/comment.rb b/app/models/comment.rb
index fa9db729f..5c7f4dd4e 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -64,7 +64,7 @@ class Comment < ActiveRecord::Base
end
def author=(author)
- self.user= author
+ self.user = author
end
def total_votes
diff --git a/app/models/concerns/conflictable.rb b/app/models/concerns/conflictable.rb
index a1926aa36..b362ef1d1 100644
--- a/app/models/concerns/conflictable.rb
+++ b/app/models/concerns/conflictable.rb
@@ -3,7 +3,7 @@ module Conflictable
def conflictive?
return false unless flags_count > 0 && cached_votes_up > 0
- cached_votes_up/flags_count.to_f < 5
+ cached_votes_up / flags_count.to_f < 5
end
end
diff --git a/app/models/legislation/annotation.rb b/app/models/legislation/annotation.rb
index 92fa9dd86..f2d419200 100644
--- a/app/models/legislation/annotation.rb
+++ b/app/models/legislation/annotation.rb
@@ -35,7 +35,7 @@ class Legislation::Annotation < ActiveRecord::Base
selector_end = "/html/body/#{range_end}"
el_end = doc.at_xpath(selector_end)
- remainder_el_start = el_start.text[0 .. range_start_offset-1] unless range_start_offset.zero?
+ remainder_el_start = el_start.text[0 .. range_start_offset - 1] unless range_start_offset.zero?
remainder_el_end = el_end.text[range_end_offset .. -1]
self.context = "#{remainder_el_start}#{quote}#{remainder_el_end}"
diff --git a/lib/score_calculator.rb b/lib/score_calculator.rb
index 0b68c025a..4f4e21e85 100644
--- a/lib/score_calculator.rb
+++ b/lib/score_calculator.rb
@@ -1,7 +1,7 @@
module ScoreCalculator
EPOC = Time.new(2015, 6, 15).in_time_zone
- COMMENT_WEIGHT = 1.0/5 # 1 positive vote / x comments
+ COMMENT_WEIGHT = 1.0 / 5 # 1 positive vote / x comments
TIME_UNIT = 24.hours.to_f
def self.hot_score(date, votes_total, votes_up, comments_count)
@@ -13,7 +13,7 @@ module ScoreCalculator
sign = score <=> 0
seconds = ((date || Time.current) - EPOC).to_f
- (((offset * sign) + (seconds/TIME_UNIT)) * 10000000).round
+ (((offset * sign) + (seconds / TIME_UNIT)) * 10000000).round
end
def self.confidence_score(votes_total, votes_up)
diff --git a/lib/sms_api.rb b/lib/sms_api.rb
index de0e2c312..9b866fc87 100644
--- a/lib/sms_api.rb
+++ b/lib/sms_api.rb
@@ -38,7 +38,7 @@ class SMSApi
end
def stubbed_response
- {:respuesta_sms=>{:identificador_mensaje=>"1234567", :fecha_respuesta=>"Thu, 20 Aug 2015 16:28:05 +0200", :respuesta_pasarela=>{:codigo_pasarela=>"0000", :descripcion_pasarela=>"Operación ejecutada correctamente."}, :respuesta_servicio_externo=>{:codigo_respuesta=>"1000", :texto_respuesta=>"Success"}}}
+ {:respuesta_sms => {:identificador_mensaje => "1234567", :fecha_respuesta => "Thu, 20 Aug 2015 16:28:05 +0200", :respuesta_pasarela => {:codigo_pasarela => "0000", :descripcion_pasarela => "Operación ejecutada correctamente."}, :respuesta_servicio_externo => {:codigo_respuesta => "1000", :texto_respuesta => "Success"}}}
end
end
diff --git a/spec/controllers/admin/api/stats_controller_spec.rb b/spec/controllers/admin/api/stats_controller_spec.rb
index e032014d7..8dd948086 100644
--- a/spec/controllers/admin/api/stats_controller_spec.rb
+++ b/spec/controllers/admin/api/stats_controller_spec.rb
@@ -36,7 +36,7 @@ describe Admin::Api::StatsController do
expect(response).to be_ok
data = JSON.parse(response.body)
- expect(data).to eq "x"=>["2015-01-01", "2015-01-02"], "Foo"=>[2, 1]
+ expect(data).to eq "x" => ["2015-01-01", "2015-01-02"], "Foo" => [2, 1]
end
it 'should return combined comma separated events formated for working with c3.js' do
@@ -46,7 +46,7 @@ describe Admin::Api::StatsController do
expect(response).to be_ok
data = JSON.parse(response.body)
- expect(data).to eq "x"=>["2015-01-01", "2015-01-02", "2015-01-03"], "Foo"=>[2, 1, 0], "Bar"=>[1, 0, 2]
+ expect(data).to eq "x" => ["2015-01-01", "2015-01-02", "2015-01-03"], "Foo" => [2, 1, 0], "Bar" => [1, 0, 2]
end
end
@@ -65,7 +65,7 @@ describe Admin::Api::StatsController do
expect(response).to be_ok
data = JSON.parse(response.body)
- expect(data).to eq "x"=>["2015-01-01", "2015-01-02"], "Visits"=>[2, 1]
+ expect(data).to eq "x" => ["2015-01-01", "2015-01-02"], "Visits" => [2, 1]
end
end
@@ -88,7 +88,7 @@ describe Admin::Api::StatsController do
expect(response).to be_ok
data = JSON.parse(response.body)
- expect(data).to eq "x"=>["2015-01-01", "2015-01-02"], "Foo"=>[1, 2], "Visits"=>[2, 1]
+ expect(data).to eq "x" => ["2015-01-01", "2015-01-02"], "Foo" => [1, 2], "Visits" => [2, 1]
end
end
@@ -107,7 +107,7 @@ describe Admin::Api::StatsController do
expect(response).to be_ok
data = JSON.parse(response.body)
- expect(data).to eq "x"=>["2017-04-01", "2017-04-02"], "Budget Investments"=>[1, 2]
+ expect(data).to eq "x" => ["2017-04-01", "2017-04-02"], "Budget Investments" => [1, 2]
end
end
end
diff --git a/spec/controllers/legislation/annotations_controller_spec.rb b/spec/controllers/legislation/annotations_controller_spec.rb
index 51425a1f2..834ec046f 100644
--- a/spec/controllers/legislation/annotations_controller_spec.rb
+++ b/spec/controllers/legislation/annotations_controller_spec.rb
@@ -16,8 +16,8 @@ describe Legislation::AnnotationsController do
post :create, process_id: @process.id,
draft_version_id: @draft_version.id,
legislation_annotation: {
- "quote"=>"ipsum",
- "ranges"=>[{"start"=>"/p[1]", "startOffset"=>6, "end"=>"/p[1]", "endOffset"=>11}],
+ "quote" => "ipsum",
+ "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],
"text": "una anotacion"
}
expect(Ahoy::Event.where(name: :legislation_annotation_created).count).to eq 1
@@ -30,8 +30,8 @@ describe Legislation::AnnotationsController do
post :create, process_id: @process.id,
draft_version_id: @final_version.id,
legislation_annotation: {
- "quote"=>"ipsum",
- "ranges"=>[{"start"=>"/p[1]", "startOffset"=>6, "end"=>"/p[1]", "endOffset"=>11}],
+ "quote" => "ipsum",
+ "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],
"text": "una anotacion"
}
@@ -45,8 +45,8 @@ describe Legislation::AnnotationsController do
xhr :post, :create, process_id: @process.id,
draft_version_id: @draft_version.id,
legislation_annotation: {
- "quote"=>"ipsum",
- "ranges"=>[{"start"=>"/p[1]", "startOffset"=>6, "end"=>"/p[1]", "endOffset"=>11}],
+ "quote" => "ipsum",
+ "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],
"text": "una anotacion"
}
end.to change { @draft_version.annotations.count }.by(1)
@@ -60,8 +60,8 @@ describe Legislation::AnnotationsController do
xhr :post, :create, process_id: @process.id,
draft_version_id: @draft_version.id,
legislation_annotation: {
- "quote"=>"ipsum",
- "ranges"=>[{"start"=>"/p[1]", "startOffset"=>6, "end"=>"/p[1]", "endOffset"=>11}],
+ "quote" => "ipsum",
+ "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],
"text": "una anotacion"
}
end.to_not change { @draft_version.annotations.count }
@@ -74,8 +74,8 @@ describe Legislation::AnnotationsController do
xhr :post, :create, process_id: @process.id,
draft_version_id: @draft_version.id,
legislation_annotation: {
- "quote"=>"ipsum",
- "ranges"=>[{"start"=>"/p[1]", "startOffset"=>6, "end"=>"/p[1]", "endOffset"=>11}].to_json,
+ "quote" => "ipsum",
+ "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}].to_json,
"text": "una anotacion"
}
end.to change { @draft_version.annotations.count }.by(1)
@@ -83,7 +83,7 @@ describe Legislation::AnnotationsController do
it 'should create a new comment on an existing annotation when range is the same' do
annotation = create(:legislation_annotation, draft_version: @draft_version, text: "my annotation",
- ranges: [{"start"=>"/p[1]", "startOffset"=>6, "end"=>"/p[1]", "endOffset"=>11}],
+ ranges: [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],
range_start: "/p[1]", range_start_offset: 6, range_end: "/p[1]", range_end_offset: 11)
sign_in @user
@@ -91,8 +91,8 @@ describe Legislation::AnnotationsController do
xhr :post, :create, process_id: @process.id,
draft_version_id: @draft_version.id,
legislation_annotation: {
- "quote"=>"ipsum",
- "ranges"=>[{"start"=>"/p[1]", "startOffset"=>6, "end"=>"/p[1]", "endOffset"=>11}],
+ "quote" => "ipsum",
+ "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],
"text": "una anotacion"
}
end.to_not change { @draft_version.annotations.count }
diff --git a/spec/factories.rb b/spec/factories.rb
index 3e7b1b674..a93d911ed 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -378,7 +378,7 @@ FactoryGirl.define do
factory :annotation do
quote "ipsum"
text "Loremp ipsum dolor"
- ranges [{"start"=>"/div[1]", "startOffset"=>5, "end"=>"/div[1]", "endOffset"=>10}]
+ ranges [{"start" => "/div[1]", "startOffset" => 5, "end" => "/div[1]", "endOffset" => 10}]
legacy_legislation
user
end
@@ -701,7 +701,7 @@ LOREM_IPSUM
author factory: :user
quote "ipsum"
text "a comment"
- ranges [{"start"=>"/p[1]", "startOffset"=>6, "end"=>"/p[1]", "endOffset"=>11}]
+ ranges [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}]
range_start "/p[1]"
range_start_offset 6
range_end "/p[1]"
diff --git a/spec/features/comments/budget_investments_spec.rb b/spec/features/comments/budget_investments_spec.rb
index 7f36106a2..73e1b0869 100644
--- a/spec/features/comments/budget_investments_spec.rb
+++ b/spec/features/comments/budget_investments_spec.rb
@@ -395,7 +395,7 @@ feature 'Commenting Budget::Investments' do
end
scenario "can not comment as a moderator" do
- admin = create(:administrator)
+ admin = create(:administrator)
login_as(admin.user)
visit budget_investment_path(investment.budget, investment)
diff --git a/spec/features/comments/debates_spec.rb b/spec/features/comments/debates_spec.rb
index 577ba6fd0..2a4d46ec3 100644
--- a/spec/features/comments/debates_spec.rb
+++ b/spec/features/comments/debates_spec.rb
@@ -407,7 +407,7 @@ feature 'Commenting debates' do
end
scenario "can not comment as a moderator" do
- admin = create(:administrator)
+ admin = create(:administrator)
login_as(admin.user)
visit debate_path(debate)
diff --git a/spec/features/comments/legislation_annotations_spec.rb b/spec/features/comments/legislation_annotations_spec.rb
index b7e57039d..d8c539201 100644
--- a/spec/features/comments/legislation_annotations_spec.rb
+++ b/spec/features/comments/legislation_annotations_spec.rb
@@ -409,7 +409,7 @@ feature 'Commenting legislation questions' do
end
scenario "can not comment as a moderator" do
- admin = create(:administrator)
+ admin = create(:administrator)
login_as(admin.user)
visit legislation_process_draft_version_annotation_path(legislation_annotation.draft_version.process, legislation_annotation.draft_version, legislation_annotation)
@@ -510,8 +510,8 @@ feature 'Commenting legislation questions' do
feature "Merged comment threads", :js do
let!(:draft_version) { create(:legislation_draft_version, :published) }
- let!(:annotation1) { create(:legislation_annotation, draft_version: draft_version, text: "my annotation", ranges: [{"start"=>"/p[1]", "startOffset"=>1, "end"=>"/p[1]", "endOffset"=>5}]) }
- let!(:annotation2) { create(:legislation_annotation, draft_version: draft_version, text: "my other annotation", ranges: [{"start"=>"/p[1]", "startOffset"=>1, "end"=>"/p[1]", "endOffset"=>10}]) }
+ let!(:annotation1) { create(:legislation_annotation, draft_version: draft_version, text: "my annotation", ranges: [{"start" => "/p[1]", "startOffset" => 1, "end" => "/p[1]", "endOffset" => 5}]) }
+ let!(:annotation2) { create(:legislation_annotation, draft_version: draft_version, text: "my other annotation", ranges: [{"start" => "/p[1]", "startOffset" => 1, "end" => "/p[1]", "endOffset" => 10}]) }
background do
login_as user
diff --git a/spec/features/comments/legislation_questions_spec.rb b/spec/features/comments/legislation_questions_spec.rb
index c10b12f55..4bdaed1ee 100644
--- a/spec/features/comments/legislation_questions_spec.rb
+++ b/spec/features/comments/legislation_questions_spec.rb
@@ -424,7 +424,7 @@ feature 'Commenting legislation questions' do
end
scenario "can not comment as a moderator" do
- admin = create(:administrator)
+ admin = create(:administrator)
login_as(admin.user)
visit legislation_process_question_path(legislation_question.process, legislation_question)
diff --git a/spec/features/comments/proposals_spec.rb b/spec/features/comments/proposals_spec.rb
index 9f3d22966..ad088b79a 100644
--- a/spec/features/comments/proposals_spec.rb
+++ b/spec/features/comments/proposals_spec.rb
@@ -395,7 +395,7 @@ feature 'Commenting proposals' do
end
scenario "can not comment as a moderator" do
- admin = create(:administrator)
+ admin = create(:administrator)
login_as(admin.user)
visit proposal_path(proposal)
diff --git a/spec/features/legacy_legislation_spec.rb b/spec/features/legacy_legislation_spec.rb
index e2f1ba915..5df3b8f76 100644
--- a/spec/features/legacy_legislation_spec.rb
+++ b/spec/features/legacy_legislation_spec.rb
@@ -77,8 +77,8 @@ feature 'Legacy Legislation' do
scenario 'Search' do
legacy_legislation = create(:legacy_legislation)
- annotation1 = create(:annotation, legacy_legislation: legacy_legislation, text: "my annotation", ranges: [{"start"=>"/div[1]", "startOffset"=>5, "end"=>"/div[1]", "endOffset"=>10}])
- annotation2 = create(:annotation, legacy_legislation: legacy_legislation, text: "my other annotation", ranges: [{"start"=>"/div[1]", "startOffset"=>12, "end"=>"/div[1]", "endOffset"=>19}])
+ annotation1 = create(:annotation, legacy_legislation: legacy_legislation, text: "my annotation", ranges: [{"start" => "/div[1]", "startOffset" => 5, "end" => "/div[1]", "endOffset" => 10}])
+ annotation2 = create(:annotation, legacy_legislation: legacy_legislation, text: "my other annotation", ranges: [{"start" => "/div[1]", "startOffset" => 12, "end" => "/div[1]", "endOffset" => 19}])
visit legacy_legislation_path(legacy_legislation)
diff --git a/spec/features/legislation/draft_versions_spec.rb b/spec/features/legislation/draft_versions_spec.rb
index 7288c0cf0..c70a8f1a3 100644
--- a/spec/features/legislation/draft_versions_spec.rb
+++ b/spec/features/legislation/draft_versions_spec.rb
@@ -173,8 +173,8 @@ feature 'Legislation Draft Versions' do
scenario 'View annotations and comments' do
draft_version = create(:legislation_draft_version, :published)
- annotation1 = create(:legislation_annotation, draft_version: draft_version, text: "my annotation", ranges: [{"start"=>"/p[1]", "startOffset"=>5, "end"=>"/p[1]", "endOffset"=>10}])
- annotation2 = create(:legislation_annotation, draft_version: draft_version, text: "my other annotation", ranges: [{"start"=>"/p[1]", "startOffset"=>12, "end"=>"/p[1]", "endOffset"=>19}])
+ annotation1 = create(:legislation_annotation, draft_version: draft_version, text: "my annotation", ranges: [{"start" => "/p[1]", "startOffset" => 5, "end" => "/p[1]", "endOffset" => 10}])
+ annotation2 = create(:legislation_annotation, draft_version: draft_version, text: "my other annotation", ranges: [{"start" => "/p[1]", "startOffset" => 12, "end" => "/p[1]", "endOffset" => 19}])
comment = create(:comment, commentable: annotation1)
visit legislation_process_draft_version_path(draft_version.process, draft_version)
@@ -190,7 +190,7 @@ feature 'Legislation Draft Versions' do
scenario "Publish new comment for an annotation from comments box" do
draft_version = create(:legislation_draft_version, :published)
- annotation = create(:legislation_annotation, draft_version: draft_version, text: "my annotation", ranges: [{"start"=>"/p[1]", "startOffset"=>6, "end"=>"/p[1]", "endOffset"=>11}])
+ annotation = create(:legislation_annotation, draft_version: draft_version, text: "my annotation", ranges: [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}])
visit legislation_process_draft_version_path(draft_version.process, draft_version)
@@ -212,8 +212,8 @@ feature 'Legislation Draft Versions' do
scenario 'View annotations and comments in an included range' do
draft_version = create(:legislation_draft_version, :published)
- annotation1 = create(:legislation_annotation, draft_version: draft_version, text: "my annotation", ranges: [{"start"=>"/p[1]", "startOffset"=>1, "end"=>"/p[1]", "endOffset"=>5}])
- annotation2 = create(:legislation_annotation, draft_version: draft_version, text: "my other annotation", ranges: [{"start"=>"/p[1]", "startOffset"=>1, "end"=>"/p[1]", "endOffset"=>10}])
+ annotation1 = create(:legislation_annotation, draft_version: draft_version, text: "my annotation", ranges: [{"start" => "/p[1]", "startOffset" => 1, "end" => "/p[1]", "endOffset" => 5}])
+ annotation2 = create(:legislation_annotation, draft_version: draft_version, text: "my other annotation", ranges: [{"start" => "/p[1]", "startOffset" => 1, "end" => "/p[1]", "endOffset" => 10}])
visit legislation_process_draft_version_path(draft_version.process, draft_version)
@@ -232,8 +232,8 @@ feature 'Legislation Draft Versions' do
context "Annotations page" do
background do
@draft_version = create(:legislation_draft_version, :published)
- @annotation_1 = create(:legislation_annotation, draft_version: @draft_version, text: "my annotation", quote: "ipsum", ranges: [{"start"=>"/p[1]", "startOffset"=>6, "end"=>"/p[1]", "endOffset"=>11}])
- @annotation_2 = create(:legislation_annotation, draft_version: @draft_version, text: "my other annotation", quote: "audiam", ranges: [{"start"=>"/p[3]", "startOffset"=>6, "end"=>"/p[3]", "endOffset"=>11}])
+ @annotation_1 = create(:legislation_annotation, draft_version: @draft_version, text: "my annotation", quote: "ipsum", ranges: [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}])
+ @annotation_2 = create(:legislation_annotation, draft_version: @draft_version, text: "my other annotation", quote: "audiam", ranges: [{"start" => "/p[3]", "startOffset" => 6, "end" => "/p[3]", "endOffset" => 11}])
end
scenario "See all annotations for a draft version" do
@@ -247,9 +247,9 @@ feature 'Legislation Draft Versions' do
background do
@process = create(:legislation_process)
@draft_version_1 = create(:legislation_draft_version, :published, process: @process, title: "Version 1", body: "Text with quote for version 1")
- @annotation_1 = create(:legislation_annotation, draft_version: @draft_version_1, text: "annotation for version 1", quote: "quote for version 1", ranges: [{"start"=>"/p[1]", "startOffset"=>11, "end"=>"/p[1]", "endOffset"=>30}])
+ @annotation_1 = create(:legislation_annotation, draft_version: @draft_version_1, text: "annotation for version 1", quote: "quote for version 1", ranges: [{"start" => "/p[1]", "startOffset" => 11, "end" => "/p[1]", "endOffset" => 30}])
@draft_version_2 = create(:legislation_draft_version, :published, process: @process, title: "Version 2", body: "Text with quote for version 2")
- @annotation_1 = create(:legislation_annotation, draft_version: @draft_version_2, text: "annotation for version 2", quote: "quote for version 2", ranges: [{"start"=>"/p[1]", "startOffset"=>11, "end"=>"/p[1]", "endOffset"=>30}])
+ @annotation_1 = create(:legislation_annotation, draft_version: @draft_version_2, text: "annotation for version 2", quote: "quote for version 2", ranges: [{"start" => "/p[1]", "startOffset" => 11, "end" => "/p[1]", "endOffset" => 30}])
end
scenario "without js" do
@@ -278,8 +278,8 @@ feature 'Legislation Draft Versions' do
context "Annotation comments page" do
background do
@draft_version = create(:legislation_draft_version, :published)
- @annotation_1 = create(:legislation_annotation, draft_version: @draft_version, text: "my annotation", quote: "ipsum", ranges: [{"start"=>"/p[1]", "startOffset"=>6, "end"=>"/p[1]", "endOffset"=>11}])
- @annotation_2 = create(:legislation_annotation, draft_version: @draft_version, text: "my other annotation", quote: "audiam", ranges: [{"start"=>"/p[3]", "startOffset"=>6, "end"=>"/p[3]", "endOffset"=>11}])
+ @annotation_1 = create(:legislation_annotation, draft_version: @draft_version, text: "my annotation", quote: "ipsum", ranges: [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}])
+ @annotation_2 = create(:legislation_annotation, draft_version: @draft_version, text: "my other annotation", quote: "audiam", ranges: [{"start" => "/p[3]", "startOffset" => 6, "end" => "/p[3]", "endOffset" => 11}])
end
scenario "See one annotation with replies for a draft version" do
diff --git a/spec/features/valuation/budget_investments_spec.rb b/spec/features/valuation/budget_investments_spec.rb
index 23d084347..7b1d48b8b 100644
--- a/spec/features/valuation/budget_investments_spec.rb
+++ b/spec/features/valuation/budget_investments_spec.rb
@@ -289,10 +289,10 @@ feature 'Valuation budget investments' do
end
scenario 'Feasibility selection makes proper fields visible', :js do
- feasible_fields = ['Price (€)', 'Cost during the first year (€)', 'Price explanation', 'Time scope']
+ feasible_fields = ['Price (€)', 'Cost during the first year (€)', 'Price explanation', 'Time scope']
unfeasible_fields = ['Feasibility explanation']
- any_feasibility_fields = ['Valuation finished', 'Internal comments']
- undecided_fields = feasible_fields + unfeasible_fields + any_feasibility_fields
+ any_feasibility_fields = ['Valuation finished', 'Internal comments']
+ undecided_fields = feasible_fields + unfeasible_fields + any_feasibility_fields
visit edit_valuation_budget_budget_investment_path(@budget, @investment)
diff --git a/spec/features/valuation/spending_proposals_spec.rb b/spec/features/valuation/spending_proposals_spec.rb
index 5b8bc34cf..2b2e06908 100644
--- a/spec/features/valuation/spending_proposals_spec.rb
+++ b/spec/features/valuation/spending_proposals_spec.rb
@@ -403,7 +403,7 @@ feature 'Valuation spending proposals' do
end
scenario "Summary table" do
- scarlett = create(:valuator)
+ scarlett = create(:valuator)
john = create(:valuator)
finished_and_feasible1 = create(:spending_proposal, valuation_finished: true, feasible: true, price: '3000000')
@@ -452,7 +452,7 @@ feature 'Valuation spending proposals' do
scenario "Order by investment project count" do
isabel = create(:valuator)
john = create(:valuator)
- scarlett = create(:valuator)
+ scarlett = create(:valuator)
3.times { create(:spending_proposal, valuators: [scarlett])}
1.times { create(:spending_proposal, valuators: [john])}
diff --git a/spec/helpers/proposals_helper_spec.rb b/spec/helpers/proposals_helper_spec.rb
index cee1ec648..d71178d9d 100644
--- a/spec/helpers/proposals_helper_spec.rb
+++ b/spec/helpers/proposals_helper_spec.rb
@@ -9,12 +9,12 @@ describe ProposalsHelper do
end
it "should be a between 1 and 100 if there are votes but less than needed" do
- proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success/2)
+ proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success / 2)
expect(progress_bar_percentage(proposal)).to eq 50
end
it "should be 100 if there are more votes than needed" do
- proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success*2)
+ proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success * 2)
expect(progress_bar_percentage(proposal)).to eq 100
end
end
@@ -31,12 +31,12 @@ describe ProposalsHelper do
end
it "should be a between 1 and 100 if there are votes but less than needed" do
- proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success/2)
+ proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success / 2)
expect(supports_percentage(proposal)).to eq "50%"
end
it "should be 100 if there are more votes than needed" do
- proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success*2)
+ proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success * 2)
expect(supports_percentage(proposal)).to eq "100%"
end
diff --git a/spec/models/ahoy/data_source_spec.rb b/spec/models/ahoy/data_source_spec.rb
index cea416498..863820710 100644
--- a/spec/models/ahoy/data_source_spec.rb
+++ b/spec/models/ahoy/data_source_spec.rb
@@ -23,14 +23,14 @@ describe Ahoy::DataSource do
it 'should work with single data sources' do
ds = Ahoy::DataSource.new
ds.add 'foo', Ahoy::Event.where(name: 'foo').group_by_day(:time).count
- expect(ds.build).to eq :x=>["2015-01-01", "2015-01-02"], "foo"=>[2, 1]
+ expect(ds.build).to eq :x => ["2015-01-01", "2015-01-02"], "foo" => [2, 1]
end
it 'should combine data sources' do
ds = Ahoy::DataSource.new
ds.add 'foo', Ahoy::Event.where(name: 'foo').group_by_day(:time).count
ds.add 'bar', Ahoy::Event.where(name: 'bar').group_by_day(:time).count
- expect(ds.build).to eq :x=>["2015-01-01", "2015-01-02", "2015-01-03"], "foo"=>[2, 1, 0], "bar"=>[1, 0, 2]
+ expect(ds.build).to eq :x => ["2015-01-01", "2015-01-02", "2015-01-03"], "foo" => [2, 1, 0], "bar" => [1, 0, 2]
end
end
end
diff --git a/spec/models/debate_spec.rb b/spec/models/debate_spec.rb
index 612775ee4..8d24f9945 100644
--- a/spec/models/debate_spec.rb
+++ b/spec/models/debate_spec.rb
@@ -545,7 +545,7 @@ describe Debate do
title_some_votes = create(:debate, title: 'stop corruption', cached_votes_up: 5)
title_least_voted = create(:debate, title: 'stop corruption', cached_votes_up: 2)
title_most_voted = create(:debate, title: 'stop corruption', cached_votes_up: 10)
- description_most_voted = create(:debate, description: 'stop corruption', cached_votes_up: 10)
+ description_most_voted = create(:debate, description: 'stop corruption', cached_votes_up: 10)
results = Debate.search('stop corruption')
diff --git a/spec/models/legislation/annotation_spec.rb b/spec/models/legislation/annotation_spec.rb
index 4cf5c6f59..0daca383a 100644
--- a/spec/models/legislation/annotation_spec.rb
+++ b/spec/models/legislation/annotation_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe Legislation::Annotation, type: :model do
Expetenda tincidunt in sed, ex partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi tincidunt, omnium virtute aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio ei, sit vidit facilisis ea. Per ne impedit iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id.
His audiam",
- ranges: [{"start"=>"/p[1]", "startOffset"=>6, "end"=>"/p[3]", "endOffset"=>11}]
+ ranges: [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[3]", "endOffset" => 11}]
)
expect(annotation.context).to eq("Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.\n\nExpetenda tincidunt in sed, ex partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi tincidunt, omnium virtute aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio ei, sit vidit facilisis ea. Per ne impedit iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id.\n\nHis audiamdeserunt in, eum ubique voluptatibus te. In reque dicta usu. Ne rebum dissentiet eam, vim omnis deseruisse id. Ullum deleniti vituperata at quo, insolens complectitur te eos, ea pri dico munere propriae. Vel ferri facilis ut, qui paulo ridens praesent ad. Possim alterum qui cu. Accusamus consulatu ius te, cu decore soleat appareat usu.")
@@ -27,7 +27,7 @@ His audiam",
annotation = create(:legislation_annotation,
draft_version: draft_version,
quote: "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.\r\n\r\nExpetenda tincidunt in sed, ex partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi tincidunt, omnium virtute aliquando ius ex. Ea aperiri sententiae duo",
- ranges: [{"start"=>"/p[1]", "startOffset"=>273, "end"=>"/p[2]", "endOffset"=>190}]
+ ranges: [{"start" => "/p[1]", "startOffset" => 273, "end" => "/p[2]", "endOffset" => 190}]
)
expect(annotation.context).to eq("Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.\r\n\r\nExpetenda tincidunt in sed, ex partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi tincidunt, omnium virtute aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio ei, sit vidit facilisis ea. Per ne impedit iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id.")
@@ -39,7 +39,7 @@ His audiam",
annotation = create(:legislation_annotation,
draft_version: draft_version,
quote: "By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.\r\n\r\nWhen we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish)",
- ranges: [{"start"=>"/p[2]", "startOffset"=>127, "end"=>"/p[3]", "endOffset"=>223}]
+ ranges: [{"start" => "/p[2]", "startOffset" => 127, "end" => "/p[3]", "endOffset" => 223}]
)
expect(annotation.context).to eq("The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.\r\n\r\nWhen we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.")
diff --git a/spec/models/poll/officer_spec.rb b/spec/models/poll/officer_spec.rb
index 1764f7200..b096aebc3 100644
--- a/spec/models/poll/officer_spec.rb
+++ b/spec/models/poll/officer_spec.rb
@@ -32,7 +32,7 @@ describe :officer do
poll_2 = create(:poll)
booth_assignment_1 = create(:poll_booth_assignment, poll: poll_1)
- booth_assignment_2 = create(:poll_booth_assignment, poll: poll_2)
+ booth_assignment_2 = create(:poll_booth_assignment, poll: poll_2)
create(:poll_officer_assignment, booth_assignment: booth_assignment_1, officer: officer, date: poll_1.starts_at)
create(:poll_officer_assignment, booth_assignment: booth_assignment_2, officer: officer, final: true)
@@ -92,7 +92,7 @@ describe :officer do
poll_2 = create(:poll)
booth_assignment_1 = create(:poll_booth_assignment, poll: poll_1)
- booth_assignment_2 = create(:poll_booth_assignment, poll: poll_2)
+ booth_assignment_2 = create(:poll_booth_assignment, poll: poll_2)
create(:poll_officer_assignment, booth_assignment: booth_assignment_1, officer: officer, date: poll_1.starts_at)
create(:poll_officer_assignment, booth_assignment: booth_assignment_2, officer: officer, final: true)
diff --git a/spec/models/poll/voter_spec.rb b/spec/models/poll/voter_spec.rb
index 752ac5bbc..c1c248550 100644
--- a/spec/models/poll/voter_spec.rb
+++ b/spec/models/poll/voter_spec.rb
@@ -33,7 +33,7 @@ describe :voter do
user = create(:user, :level_two)
voter1 = create(:poll_voter, user: user, poll: poll)
- voter2 = build(:poll_voter, user: user, poll: poll)
+ voter2 = build(:poll_voter, user: user, poll: poll)
expect(voter2).to_not be_valid
expect(voter2.errors.messages[:document_number]).to eq(["User has already voted"])
@@ -43,7 +43,7 @@ describe :voter do
user = create(:user, :level_two)
voter1 = create(:poll_voter, user: user, poll: poll, booth_assignment: booth_assignment)
- voter2 = build(:poll_voter, user: user, poll: poll, booth_assignment: booth_assignment)
+ voter2 = build(:poll_voter, user: user, poll: poll, booth_assignment: booth_assignment)
expect(voter2).to_not be_valid
expect(voter2.errors.messages[:document_number]).to eq(["User has already voted"])
@@ -56,7 +56,7 @@ describe :voter do
user = create(:user, :level_two)
voter1 = create(:poll_voter, user: user, poll: poll, booth_assignment: booth_assignment1)
- voter2 = build(:poll_voter, user: user, poll: poll, booth_assignment: booth_assignment2)
+ voter2 = build(:poll_voter, user: user, poll: poll, booth_assignment: booth_assignment2)
expect(voter2).to_not be_valid
expect(voter2.errors.messages[:document_number]).to eq(["User has already voted"])
@@ -69,7 +69,7 @@ describe :voter do
user = create(:user, :level_two)
voter1 = create(:poll_voter, user: user, booth_assignment: booth_assignment1)
- voter2 = build(:poll_voter, user: user, booth_assignment: booth_assignment2)
+ voter2 = build(:poll_voter, user: user, booth_assignment: booth_assignment2)
expect(voter2).to be_valid
end
diff --git a/spec/models/residence_spec.rb b/spec/models/residence_spec.rb
index 98b939084..d518c41af 100644
--- a/spec/models/residence_spec.rb
+++ b/spec/models/residence_spec.rb
@@ -13,19 +13,19 @@ describe Verification::Residence do
describe "dates" do
it "should be valid with a valid date of birth" do
- residence = Verification::Residence.new({"date_of_birth(3i)"=>"1", "date_of_birth(2i)"=>"1", "date_of_birth(1i)"=>"1980"})
+ residence = Verification::Residence.new({"date_of_birth(3i)" => "1", "date_of_birth(2i)" => "1", "date_of_birth(1i)" => "1980"})
expect(residence.errors[:date_of_birth].size).to eq(0)
end
it "should not be valid without a date of birth" do
- residence = Verification::Residence.new({"date_of_birth(3i)"=>"", "date_of_birth(2i)"=>"", "date_of_birth(1i)"=>""})
+ residence = Verification::Residence.new({"date_of_birth(3i)" => "", "date_of_birth(2i)" => "", "date_of_birth(1i)" => ""})
expect(residence).to_not be_valid
expect(residence.errors[:date_of_birth]).to include("can't be blank")
end
end
it "should validate user has allowed age" do
- residence = Verification::Residence.new({"date_of_birth(3i)"=>"1", "date_of_birth(2i)"=>"1", "date_of_birth(1i)"=>"#{5.years.ago.year}"})
+ residence = Verification::Residence.new({"date_of_birth(3i)" => "1", "date_of_birth(2i)" => "1", "date_of_birth(1i)" => "#{5.years.ago.year}"})
expect(residence).to_not be_valid
expect(residence.errors[:date_of_birth]).to include("You don't have the required age to participate")
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 2bf09f378..0ea321423 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -220,7 +220,7 @@ describe User do
subject.username = nil
expect(subject).to be_valid
- subject.organization.name= nil
+ subject.organization.name = nil
expect(subject).to_not be_valid
end
end