Add and apply ParenthesesAsGroupedExpression rule
This commit is contained in:
@@ -126,6 +126,9 @@ Lint/DuplicateMethods:
|
|||||||
Lint/LiteralAsCondition:
|
Lint/LiteralAsCondition:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Lint/ParenthesesAsGroupedExpression:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Lint/ShadowingOuterLocalVariable:
|
Lint/ShadowingOuterLocalVariable:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ class RemoteTranslations::Microsoft::AvailableLocales
|
|||||||
host = "https://api.cognitive.microsofttranslator.com"
|
host = "https://api.cognitive.microsofttranslator.com"
|
||||||
path = "/languages?api-version=3.0"
|
path = "/languages?api-version=3.0"
|
||||||
|
|
||||||
uri = URI (host + path)
|
uri = URI(host + path)
|
||||||
|
|
||||||
request = Net::HTTP::Get.new(uri)
|
request = Net::HTTP::Get.new(uri)
|
||||||
request["Ocp-Apim-Subscription-Key"] = Rails.application.secrets.microsoft_api_key
|
request["Ocp-Apim-Subscription-Key"] = Rails.application.secrets.microsoft_api_key
|
||||||
|
|
||||||
response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == "https") do |http|
|
response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == "https") do |http|
|
||||||
http.request (request)
|
http.request(request)
|
||||||
end
|
end
|
||||||
|
|
||||||
result = response.body.force_encoding("utf-8")
|
result = response.body.force_encoding("utf-8")
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ describe "Admin dashboard actions" do
|
|||||||
|
|
||||||
before do
|
before do
|
||||||
visit admin_dashboard_actions_path
|
visit admin_dashboard_actions_path
|
||||||
within ("#dashboard_action_#{action.id}") do
|
within "#dashboard_action_#{action.id}" do
|
||||||
click_link "Edit"
|
click_link "Edit"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -51,13 +51,13 @@ describe "Admin collaborative legislation" do
|
|||||||
|
|
||||||
visit admin_legislation_processes_path(filter: "all")
|
visit admin_legislation_processes_path(filter: "all")
|
||||||
|
|
||||||
expect(page).to have_content (process_1.start_date)
|
expect(page).to have_content process_1.start_date
|
||||||
expect(page).to have_content (process_2.start_date)
|
expect(page).to have_content process_2.start_date
|
||||||
expect(page).to have_content (process_3.start_date)
|
expect(page).to have_content process_3.start_date
|
||||||
|
|
||||||
expect(page).to have_content (process_1.end_date)
|
expect(page).to have_content process_1.end_date
|
||||||
expect(page).to have_content (process_2.end_date)
|
expect(page).to have_content process_2.end_date
|
||||||
expect(page).to have_content (process_3.end_date)
|
expect(page).to have_content process_3.end_date
|
||||||
|
|
||||||
expect(process_3.title).to appear_before(process_2.title)
|
expect(process_3.title).to appear_before(process_2.title)
|
||||||
expect(process_2.title).to appear_before(process_1.title)
|
expect(process_2.title).to appear_before(process_1.title)
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ describe "Cards" do
|
|||||||
card_2 = create(:widget_card, page: custom_page, title: "Card medium", columns: 4)
|
card_2 = create(:widget_card, page: custom_page, title: "Card medium", columns: 4)
|
||||||
card_3 = create(:widget_card, page: custom_page, title: "Card small", columns: 2)
|
card_3 = create(:widget_card, page: custom_page, title: "Card small", columns: 2)
|
||||||
|
|
||||||
visit (custom_page).url
|
visit custom_page.url
|
||||||
|
|
||||||
expect(page).to have_css(".card", count: 3)
|
expect(page).to have_css(".card", count: 3)
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ describe "Cards" do
|
|||||||
card_1 = create(:widget_card, page: custom_page, title: "Card one", label: "My label")
|
card_1 = create(:widget_card, page: custom_page, title: "Card one", label: "My label")
|
||||||
card_2 = create(:widget_card, page: custom_page, title: "Card two")
|
card_2 = create(:widget_card, page: custom_page, title: "Card two")
|
||||||
|
|
||||||
visit (custom_page).url
|
visit custom_page.url
|
||||||
|
|
||||||
within("#widget_card_#{card_1.id}") do
|
within("#widget_card_#{card_1.id}") do
|
||||||
expect(page).to have_selector("span", text: "My label")
|
expect(page).to have_selector("span", text: "My label")
|
||||||
|
|||||||
@@ -86,15 +86,15 @@ describe RemoteCensusApi do
|
|||||||
|
|
||||||
request = RemoteCensusApi.new.send(:request, document_type, document_number, nil, nil)
|
request = RemoteCensusApi.new.send(:request, document_type, document_number, nil, nil)
|
||||||
|
|
||||||
expect(request).to eq ({ :request =>
|
expect(request).to eq({ :request =>
|
||||||
{ :codigo_institucion => 1,
|
{ :codigo_institucion => 1,
|
||||||
:codigo_portal => 1,
|
:codigo_portal => 1,
|
||||||
:codigo_usuario => 1,
|
:codigo_usuario => 1,
|
||||||
:documento => "0123456",
|
:documento => "0123456",
|
||||||
:tipo_documento => "1",
|
:tipo_documento => "1",
|
||||||
:codigo_idioma => "102",
|
:codigo_idioma => "102",
|
||||||
:nivel => "3" }
|
:nivel => "3" }
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
it "when send date_of_birth and postal_code but are not configured" do
|
it "when send date_of_birth and postal_code but are not configured" do
|
||||||
@@ -105,15 +105,15 @@ describe RemoteCensusApi do
|
|||||||
|
|
||||||
request = RemoteCensusApi.new.send(:request, document_type, document_number, date_of_birth, postal_code)
|
request = RemoteCensusApi.new.send(:request, document_type, document_number, date_of_birth, postal_code)
|
||||||
|
|
||||||
expect(request).to eq ({ :request =>
|
expect(request).to eq({ :request =>
|
||||||
{ :codigo_institucion => 1,
|
{ :codigo_institucion => 1,
|
||||||
:codigo_portal => 1,
|
:codigo_portal => 1,
|
||||||
:codigo_usuario => 1,
|
:codigo_usuario => 1,
|
||||||
:documento => "0123456",
|
:documento => "0123456",
|
||||||
:tipo_documento => "1",
|
:tipo_documento => "1",
|
||||||
:codigo_idioma => "102",
|
:codigo_idioma => "102",
|
||||||
:nivel => "3" }
|
:nivel => "3" }
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
it "when send date_of_birth and postal_code but are configured" do
|
it "when send date_of_birth and postal_code but are configured" do
|
||||||
@@ -137,17 +137,17 @@ describe RemoteCensusApi do
|
|||||||
|
|
||||||
request = RemoteCensusApi.new.send(:request, document_type, document_number, date_of_birth, postal_code)
|
request = RemoteCensusApi.new.send(:request, document_type, document_number, date_of_birth, postal_code)
|
||||||
|
|
||||||
expect(request).to eq ({ :request =>
|
expect(request).to eq({ :request =>
|
||||||
{ :codigo_institucion => 1,
|
{ :codigo_institucion => 1,
|
||||||
:codigo_portal => 1,
|
:codigo_portal => 1,
|
||||||
:codigo_usuario => 1,
|
:codigo_usuario => 1,
|
||||||
:documento => "0123456",
|
:documento => "0123456",
|
||||||
:tipo_documento => "1",
|
:tipo_documento => "1",
|
||||||
:fecha_nacimiento => "1980-01-01",
|
:fecha_nacimiento => "1980-01-01",
|
||||||
:codigo_postal => "28001",
|
:codigo_postal => "28001",
|
||||||
:codigo_idioma => "102",
|
:codigo_idioma => "102",
|
||||||
:nivel => "3" }
|
:nivel => "3" }
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -164,26 +164,26 @@ describe RemoteCensusApi do
|
|||||||
|
|
||||||
response = RemoteCensusApi.new.send(:get_response_body, document_type, document_number, nil, nil)
|
response = RemoteCensusApi.new.send(:get_response_body, document_type, document_number, nil, nil)
|
||||||
|
|
||||||
expect(response).to eq ({ get_habita_datos_response: {
|
expect(response).to eq({ get_habita_datos_response: {
|
||||||
get_habita_datos_return: {
|
get_habita_datos_return: {
|
||||||
datos_habitante: {
|
datos_habitante: {
|
||||||
item: {
|
item: {
|
||||||
fecha_nacimiento_string: "31-12-1980",
|
fecha_nacimiento_string: "31-12-1980",
|
||||||
identificador_documento: "12345678Z",
|
identificador_documento: "12345678Z",
|
||||||
descripcion_sexo: "Varón",
|
descripcion_sexo: "Varón",
|
||||||
nombre: "José",
|
nombre: "José",
|
||||||
apellido1: "García"
|
apellido1: "García"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
datos_vivienda: {
|
datos_vivienda: {
|
||||||
item: {
|
item: {
|
||||||
codigo_postal: "28013",
|
codigo_postal: "28013",
|
||||||
codigo_distrito: "01"
|
codigo_distrito: "01"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ describe Budget::Phase do
|
|||||||
second_phase.update_attributes(enabled: false,
|
second_phase.update_attributes(enabled: false,
|
||||||
starts_at: Date.current,
|
starts_at: Date.current,
|
||||||
ends_at: Date.current + 2.days)
|
ends_at: Date.current + 2.days)
|
||||||
end.not_to (change { prev_enabled_phase.ends_at })
|
end.not_to change { prev_enabled_phase.ends_at }
|
||||||
end
|
end
|
||||||
|
|
||||||
it "adjusts next enabled phase start date to its own start date" do
|
it "adjusts next enabled phase start date to its own start date" do
|
||||||
|
|||||||
@@ -277,28 +277,28 @@ describe Budget do
|
|||||||
budget.update(currency_symbol: "€")
|
budget.update(currency_symbol: "€")
|
||||||
I18n.locale = :es
|
I18n.locale = :es
|
||||||
|
|
||||||
expect(budget.formatted_amount(1000.00)).to eq ("1.000 €")
|
expect(budget.formatted_amount(1000.00)).to eq "1.000 €"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "correctly formats Dollars with Spanish" do
|
it "correctly formats Dollars with Spanish" do
|
||||||
budget.update(currency_symbol: "$")
|
budget.update(currency_symbol: "$")
|
||||||
I18n.locale = :es
|
I18n.locale = :es
|
||||||
|
|
||||||
expect(budget.formatted_amount(1000.00)).to eq ("1.000 $")
|
expect(budget.formatted_amount(1000.00)).to eq "1.000 $"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "correctly formats Dollars with English" do
|
it "correctly formats Dollars with English" do
|
||||||
budget.update(currency_symbol: "$")
|
budget.update(currency_symbol: "$")
|
||||||
I18n.locale = :en
|
I18n.locale = :en
|
||||||
|
|
||||||
expect(budget.formatted_amount(1000.00)).to eq ("$1,000")
|
expect(budget.formatted_amount(1000.00)).to eq "$1,000"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "correctly formats Euros with English" do
|
it "correctly formats Euros with English" do
|
||||||
budget.update(currency_symbol: "€")
|
budget.update(currency_symbol: "€")
|
||||||
I18n.locale = :en
|
I18n.locale = :en
|
||||||
|
|
||||||
expect(budget.formatted_amount(1000.00)).to eq ("€1,000")
|
expect(budget.formatted_amount(1000.00)).to eq "€1,000"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ shared_examples_for "sluggable" do |updatable_slug_trait:|
|
|||||||
context "slug updating condition is false" do
|
context "slug updating condition is false" do
|
||||||
it "slug isn't updated" do
|
it "slug isn't updated" do
|
||||||
expect { sluggable.update_attributes(name: "New Name") }
|
expect { sluggable.update_attributes(name: "New Name") }
|
||||||
.not_to (change { sluggable.slug })
|
.not_to change { sluggable.slug }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user