Add and apply rules for multi-line hashes
For the HashAlignment rule, we're using the default `key` style (keys are aligned and values aren't) instead of the `table` style (both keys and values are aligned) because, even if we used both in the application, we used the `key` style a lot more. Furthermore, the `table` style looks strange in places where there are both very long and very short keys and sometimes we weren't even consistent with the `table` style, aligning some keys without aligning other keys. Ideally we could align hashes to "either key or table", so developers can decide whether keeping the symmetry of the code is worth it in a case-per-case basis, but Rubocop doesn't allow this option.
This commit is contained in:
@@ -8,10 +8,10 @@ describe Admin::Poll::Questions::Answers::VideosController, :admin do
|
||||
it "is not possible for an already started poll" do
|
||||
post :create, params: {
|
||||
poll_question_answer_video: {
|
||||
title: "Video from started poll",
|
||||
url: "https://www.youtube.com/watch?v=-JMf43st-1A"
|
||||
},
|
||||
answer_id: current_answer
|
||||
title: "Video from started poll",
|
||||
url: "https://www.youtube.com/watch?v=-JMf43st-1A"
|
||||
},
|
||||
answer_id: current_answer
|
||||
}
|
||||
|
||||
expect(flash[:alert]).to eq "You do not have permission to carry out the action 'create' on Video."
|
||||
@@ -21,8 +21,8 @@ describe Admin::Poll::Questions::Answers::VideosController, :admin do
|
||||
it "is possible for a not started poll" do
|
||||
post :create, params: {
|
||||
poll_question_answer_video: {
|
||||
title: "Video from not started poll",
|
||||
url: "https://www.youtube.com/watch?v=-JMf43st-1A"
|
||||
title: "Video from not started poll",
|
||||
url: "https://www.youtube.com/watch?v=-JMf43st-1A"
|
||||
},
|
||||
answer_id: future_answer
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ describe CommentsController do
|
||||
describe "POST create" do
|
||||
let(:legal_process) do
|
||||
create(:legislation_process, debate_start_date: Date.current - 3.days,
|
||||
debate_end_date: Date.current + 2.days)
|
||||
debate_end_date: Date.current + 2.days)
|
||||
end
|
||||
let(:question) { create(:legislation_question, process: legal_process, title: "Question 1") }
|
||||
let(:user) { create(:user, :level_two) }
|
||||
@@ -53,13 +53,13 @@ describe CommentsController do
|
||||
|
||||
expect do
|
||||
post :create, xhr: true,
|
||||
params: {
|
||||
comment: {
|
||||
commentable_id: annotation.id,
|
||||
commentable_type: "Legislation::Annotation",
|
||||
body: "a comment"
|
||||
}
|
||||
}
|
||||
params: {
|
||||
comment: {
|
||||
commentable_id: annotation.id,
|
||||
commentable_type: "Legislation::Annotation",
|
||||
body: "a comment"
|
||||
}
|
||||
}
|
||||
end.not_to change { annotation.reload.comments_count }
|
||||
end
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ describe Legislation::AnnotationsController do
|
||||
describe "POST create" do
|
||||
let(:legal_process) do
|
||||
create(:legislation_process, allegations_start_date: Date.current - 3.days,
|
||||
allegations_end_date: Date.current + 2.days)
|
||||
allegations_end_date: Date.current + 2.days)
|
||||
end
|
||||
let(:draft_version) do
|
||||
create(:legislation_draft_version, :published, process: legal_process, title: "Version 1")
|
||||
@@ -40,19 +40,19 @@ describe Legislation::AnnotationsController do
|
||||
sign_in user
|
||||
|
||||
post :create, params: {
|
||||
process_id: legal_process.id,
|
||||
draft_version_id: draft_version.id,
|
||||
legislation_annotation: {
|
||||
"quote" => "ipsum",
|
||||
"ranges" => [{
|
||||
"start" => "/p[1]",
|
||||
"startOffset" => 6,
|
||||
"end" => "/p[1]",
|
||||
"endOffset" => 11
|
||||
}],
|
||||
"text" => "una anotacion"
|
||||
}
|
||||
}
|
||||
process_id: legal_process.id,
|
||||
draft_version_id: draft_version.id,
|
||||
legislation_annotation: {
|
||||
"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
|
||||
expect(Ahoy::Event.last.properties["legislation_annotation_id"]).to eq Legislation::Annotation.last.id
|
||||
end
|
||||
@@ -61,19 +61,19 @@ describe Legislation::AnnotationsController do
|
||||
sign_in user
|
||||
|
||||
post :create, params: {
|
||||
process_id: legal_process.id,
|
||||
draft_version_id: final_version.id,
|
||||
legislation_annotation: {
|
||||
"quote" => "ipsum",
|
||||
"ranges" => [{
|
||||
"start" => "/p[1]",
|
||||
"startOffset" => 6,
|
||||
"end" => "/p[1]",
|
||||
"endOffset" => 11
|
||||
}],
|
||||
"text" => "una anotacion"
|
||||
}
|
||||
}
|
||||
process_id: legal_process.id,
|
||||
draft_version_id: final_version.id,
|
||||
legislation_annotation: {
|
||||
"quote" => "ipsum",
|
||||
"ranges" => [{
|
||||
"start" => "/p[1]",
|
||||
"startOffset" => 6,
|
||||
"end" => "/p[1]",
|
||||
"endOffset" => 11
|
||||
}],
|
||||
"text" => "una anotacion"
|
||||
}
|
||||
}
|
||||
|
||||
expect(response).to have_http_status(:not_found)
|
||||
end
|
||||
@@ -87,14 +87,14 @@ describe Legislation::AnnotationsController do
|
||||
process_id: legal_process.id,
|
||||
draft_version_id: draft_version.id,
|
||||
legislation_annotation: {
|
||||
"quote" => "ipsum",
|
||||
"quote" => "ipsum",
|
||||
"ranges" => [{
|
||||
"start" => "/p[1]",
|
||||
"startOffset" => 6,
|
||||
"end" => "/p[1]",
|
||||
"endOffset" => 11
|
||||
}],
|
||||
"text" => "una anotacion"
|
||||
"start" => "/p[1]",
|
||||
"startOffset" => 6,
|
||||
"end" => "/p[1]",
|
||||
"endOffset" => 11
|
||||
}],
|
||||
"text" => "una anotacion"
|
||||
}
|
||||
}
|
||||
end.to change { draft_version.annotations.count }.by(1)
|
||||
@@ -112,11 +112,11 @@ describe Legislation::AnnotationsController do
|
||||
legislation_annotation: {
|
||||
"quote" => "ipsum",
|
||||
"ranges" => [{
|
||||
"start" => "/p[1]",
|
||||
"startOffset" => 6,
|
||||
"end" => "/p[1]",
|
||||
"endOffset" => 11
|
||||
}],
|
||||
"start" => "/p[1]",
|
||||
"startOffset" => 6,
|
||||
"end" => "/p[1]",
|
||||
"endOffset" => 11
|
||||
}],
|
||||
"text" => "una anotacion"
|
||||
}
|
||||
}
|
||||
@@ -132,14 +132,14 @@ describe Legislation::AnnotationsController do
|
||||
process_id: legal_process.id,
|
||||
draft_version_id: draft_version.id,
|
||||
legislation_annotation: {
|
||||
"quote" => "ipsum",
|
||||
"quote" => "ipsum",
|
||||
"ranges" => [{
|
||||
"start" => "/p[1]",
|
||||
"startOffset" => 6,
|
||||
"end" => "/p[1]",
|
||||
"endOffset" => 11
|
||||
}].to_json,
|
||||
"text" => "una anotacion"
|
||||
"start" => "/p[1]",
|
||||
"startOffset" => 6,
|
||||
"end" => "/p[1]",
|
||||
"endOffset" => 11
|
||||
}].to_json,
|
||||
"text" => "una anotacion"
|
||||
}
|
||||
}
|
||||
end.to change { draft_version.annotations.count }.by(1)
|
||||
@@ -149,15 +149,15 @@ describe Legislation::AnnotationsController do
|
||||
annotation = create(:legislation_annotation, draft_version: draft_version,
|
||||
text: "my annotation",
|
||||
ranges: [{
|
||||
"start" => "/p[1]",
|
||||
"startOffset" => 6,
|
||||
"end" => "/p[1]",
|
||||
"endOffset" => 11
|
||||
}],
|
||||
range_start: "/p[1]",
|
||||
"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)
|
||||
range_end: "/p[1]",
|
||||
range_end_offset: 11)
|
||||
sign_in user
|
||||
|
||||
expect do
|
||||
@@ -166,14 +166,14 @@ describe Legislation::AnnotationsController do
|
||||
process_id: legal_process.id,
|
||||
draft_version_id: draft_version.id,
|
||||
legislation_annotation: {
|
||||
"quote" => "ipsum",
|
||||
"quote" => "ipsum",
|
||||
"ranges" => [{
|
||||
"start" => "/p[1]",
|
||||
"startOffset" => 6,
|
||||
"end" => "/p[1]",
|
||||
"endOffset" => 11
|
||||
}],
|
||||
"text" => "una anotacion"
|
||||
"start" => "/p[1]",
|
||||
"startOffset" => 6,
|
||||
"end" => "/p[1]",
|
||||
"endOffset" => 11
|
||||
}],
|
||||
"text" => "una anotacion"
|
||||
}
|
||||
}
|
||||
end.not_to change { draft_version.annotations.count }
|
||||
|
||||
@@ -4,7 +4,7 @@ describe Legislation::AnswersController do
|
||||
describe "POST create" do
|
||||
let(:legal_process) do
|
||||
create(:legislation_process, debate_start_date: Date.current - 3.days,
|
||||
debate_end_date: Date.current + 2.days)
|
||||
debate_end_date: Date.current + 2.days)
|
||||
end
|
||||
let(:question) { create(:legislation_question, process: legal_process, title: "Question 1") }
|
||||
let(:question_option) { create(:legislation_question_option, question: question, value: "Yes") }
|
||||
@@ -14,12 +14,12 @@ describe Legislation::AnswersController do
|
||||
sign_in user
|
||||
|
||||
post :create, params: {
|
||||
process_id: legal_process.id,
|
||||
question_id: question.id,
|
||||
legislation_answer: {
|
||||
legislation_question_option_id: question_option.id
|
||||
}
|
||||
}
|
||||
process_id: legal_process.id,
|
||||
question_id: question.id,
|
||||
legislation_answer: {
|
||||
legislation_question_option_id: question_option.id
|
||||
}
|
||||
}
|
||||
expect(Ahoy::Event.where(name: :legislation_answer_created).count).to eq 1
|
||||
expect(Ahoy::Event.last.properties["legislation_answer_id"]).to eq Legislation::Answer.last.id
|
||||
end
|
||||
|
||||
@@ -16,10 +16,10 @@ describe Management::SessionsController do
|
||||
allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(manager)
|
||||
|
||||
get :create, params: {
|
||||
login: "JJB033",
|
||||
clave_usuario: "31415926",
|
||||
fecha_conexion: "20151031135905"
|
||||
}
|
||||
login: "JJB033",
|
||||
clave_usuario: "31415926",
|
||||
fecha_conexion: "20151031135905"
|
||||
}
|
||||
expect(response).to be_redirect
|
||||
expect(session[:manager][:login]).to eq "JJB033"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user