AyuntamientoMadrid/participacion

View on GitHub
spec/system/admin/budget_investments_spec.rb

Summary

Maintainability
F
6 days
Test Coverage

File budget_investments_spec.rb has 1432 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "rails_helper"

describe "Admin budget investments", :admin do
  let(:budget) { create(:budget) }
  let(:administrator) do
Severity: Major
Found in spec/system/admin/budget_investments_spec.rb - About 3 days to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        scenario "Filtering by minimum number of votes" do
          group_1 = create(:budget_group, budget: budget)
          group_2 = create(:budget_group, budget: budget)
          parks   = create(:budget_heading, group: group_1)
          roads   = create(:budget_heading, group: group_2)
    Severity: Major
    Found in spec/system/admin/budget_investments_spec.rb and 1 other location - About 4 hrs to fix
    spec/system/admin/budget_investments_spec.rb on lines 582..615

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 165.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        scenario "Filtering by maximum number of votes" do
          group_1 = create(:budget_group, budget: budget)
          group_2 = create(:budget_group, budget: budget)
          parks   = create(:budget_heading, group: group_1)
          roads   = create(:budget_heading, group: group_2)
    Severity: Major
    Found in spec/system/admin/budget_investments_spec.rb and 1 other location - About 4 hrs to fix
    spec/system/admin/budget_investments_spec.rb on lines 546..579

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 165.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        context "Ascending" do
          scenario "Sort by ID" do
            visit admin_budget_budget_investments_path(budget, sort_by: "id", direction: "asc")
    
            expect("B First Investment").to appear_before("A Second Investment")
    Severity: Major
    Found in spec/system/admin/budget_investments_spec.rb and 1 other location - About 3 hrs to fix
    spec/system/admin/budget_investments_spec.rb on lines 853..881

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 112.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        context "Descending" do
          scenario "Sort by ID" do
            visit admin_budget_budget_investments_path(budget, sort_by: "id", direction: "desc")
    
            expect("C Third Investment").to appear_before("A Second Investment")
    Severity: Major
    Found in spec/system/admin/budget_investments_spec.rb and 1 other location - About 3 hrs to fix
    spec/system/admin/budget_investments_spec.rb on lines 821..849

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 112.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        scenario "Filtering by without assigned valuator" do
          create(:budget_investment, title: "Investment without valuator", budget: budget)
          create(:budget_investment, :with_valuator, title: "Investment with valuator", budget: budget)
    
          visit admin_budget_budget_investments_path(budget_id: budget)
    Severity: Major
    Found in spec/system/admin/budget_investments_spec.rb and 2 other locations - About 1 hr to fix
    spec/system/admin/budget_investments_spec.rb on lines 255..276
    spec/system/admin/budget_investments_spec.rb on lines 339..360

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 74.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        scenario "Filtering by without assigned admin" do
          create(:budget_investment, title: "Investment without admin", budget: budget)
          create(:budget_investment, :with_administrator, title: "Investment with admin", budget: budget)
    
          visit admin_budget_budget_investments_path(budget_id: budget)
    Severity: Major
    Found in spec/system/admin/budget_investments_spec.rb and 2 other locations - About 1 hr to fix
    spec/system/admin/budget_investments_spec.rb on lines 279..300
    spec/system/admin/budget_investments_spec.rb on lines 339..360

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 74.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        scenario "Filtering by valuation finished" do
          create(:budget_investment, title: "Investment valuation open", budget: budget)
          create(:budget_investment, :finished, title: "Investment valuation finished", budget: budget)
    
          visit admin_budget_budget_investments_path(budget_id: budget)
    Severity: Major
    Found in spec/system/admin/budget_investments_spec.rb and 2 other locations - About 1 hr to fix
    spec/system/admin/budget_investments_spec.rb on lines 255..276
    spec/system/admin/budget_investments_spec.rb on lines 279..300

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 74.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

          scenario "Sort by supports" do
            visit admin_budget_budget_investments_path(budget, sort_by: "supports")
    
            expect("C Third Investment").to appear_before("A Second Investment")
            expect("A Second Investment").to appear_before("B First Investment")
    Severity: Minor
    Found in spec/system/admin/budget_investments_spec.rb and 2 other locations - About 35 mins to fix
    spec/system/admin/budget_investments_spec.rb on lines 886..893
    spec/system/admin/budget_investments_spec.rb on lines 896..903

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 34.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

          scenario "Sort by title" do
            visit admin_budget_budget_investments_path(budget, sort_by: "title")
    
            expect("A Second Investment").to appear_before("B First Investment")
            expect("B First Investment").to appear_before("C Third Investment")
    Severity: Minor
    Found in spec/system/admin/budget_investments_spec.rb and 2 other locations - About 35 mins to fix
    spec/system/admin/budget_investments_spec.rb on lines 886..893
    spec/system/admin/budget_investments_spec.rb on lines 906..913

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 34.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

          scenario "Sort by ID" do
            visit admin_budget_budget_investments_path(budget, sort_by: "id")
    
            expect("B First Investment").to appear_before("A Second Investment")
            expect("A Second Investment").to appear_before("C Third Investment")
    Severity: Minor
    Found in spec/system/admin/budget_investments_spec.rb and 2 other locations - About 35 mins to fix
    spec/system/admin/budget_investments_spec.rb on lines 896..903
    spec/system/admin/budget_investments_spec.rb on lines 906..913

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 34.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          within("#budget_investment_#{budget_investment2.id}") do
            expect(page).to have_content("No admin assigned")
            expect(page).to have_content("Valuator Olga")
            expect(page).to have_content("Valuator Miriam")
            expect(page).to have_content("Health")
    Severity: Minor
    Found in spec/system/admin/budget_investments_spec.rb and 1 other location - About 20 mins to fix
    spec/system/admin/budget_investments_spec.rb on lines 1230..1234

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 27.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          within("#tags_budget_investment_#{budget_investment.id}") do
            expect(page).not_to have_content "Education"
            expect(page).not_to have_content "Environment"
            expect(page).to have_content "Park"
            expect(page).to have_content "Trees"
    Severity: Minor
    Found in spec/system/admin/budget_investments_spec.rb and 1 other location - About 20 mins to fix
    spec/system/admin/budget_investments_spec.rb on lines 82..86

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 27.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status