Add and apply ParenthesesAsGroupedExpression rule

This commit is contained in:
Javi Martín
2019-09-28 23:02:02 +02:00
parent 447c970eb3
commit 871fa020a5
9 changed files with 69 additions and 66 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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")

View File

@@ -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

View File

@@ -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

View File

@@ -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