spec/features/management/budget_investments_spec.rb

Summary

Maintainability
A
2 hrs
Test Coverage

TODO found
Open

  # CDJ Custom : broken but no time to investigate TODO

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

      within("#budget-investments") do
        expect(page).to have_css('.budget-investment', count: 1)
        expect(page).to have_content(budget_investment1.title)
        expect(page).not_to have_content(budget_investment2.title)
        expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']",
Severity: Minor
Found in spec/features/management/budget_investments_spec.rb and 1 other location - About 40 mins to fix
spec/features/management/budget_investments_spec.rb on lines 119..124

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 38.

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-investments") do
        expect(page).to have_css('.budget-investment', count: 1)
        expect(page).not_to have_content(budget_investment1.title)
        expect(page).to have_content(budget_investment2.title)
        expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']",
Severity: Minor
Found in spec/features/management/budget_investments_spec.rb and 1 other location - About 40 mins to fix
spec/features/management/budget_investments_spec.rb on lines 92..97

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 38.

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

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

  background do
    login_as_manager
    @budget = create(:budget, phase: 'selecting', name: "2033")
    @group = create(:budget_group, budget: @budget, name: 'Whole city')
    @heading = create(:budget_heading, group: @group, name: "Health")
Severity: Minor
Found in spec/features/management/budget_investments_spec.rb and 1 other location - About 20 mins to fix
spec/custom/features/management/budget_investments_spec.rb on lines 14..18

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 28.

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

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

    within(".account-info") do
      expect(page).to have_content "Identified as"
      expect(page).to have_content user.username
      expect(page).to have_content user.email
      expect(page).to have_content user.document_number
Severity: Minor
Found in spec/features/management/budget_investments_spec.rb and 1 other location - About 20 mins to fix
spec/features/management/budget_investments_spec.rb on lines 36..40

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

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

      within(".account-info") do
        expect(page).to have_content "Identified as"
        expect(page).to have_content user.username
        expect(page).to have_content user.email
        expect(page).to have_content user.document_number
Severity: Minor
Found in spec/features/management/budget_investments_spec.rb and 1 other location - About 20 mins to fix
spec/features/management/budget_investments_spec.rb on lines 142..146

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

Line is too long. [101/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

      budget_investment1 = create(:budget_investment, budget: @budget, title: "Show me what you got")

Line is too long. [111/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

        expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']",

Line is too long. [104/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

                                                      heading: create(:budget_heading, name: "Area 52"))

Line is too long. [107/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

                                                      heading: create(:budget_heading, name: "District 9"))

Line is too long. [111/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

        expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']",

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      expect(page).to have_content I18n.l(@budget.created_at.to_date)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      within "#budget_#{@budget.id}" do

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      within "#budget_#{@budget.id}" do

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      budget_investment = create(:budget_investment, budget: @budget)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      another_heading = create(:budget_heading, group: @group)

Line is too long. [136/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

      mid_investment = create(:budget_investment, budget: @budget, title: 'Change district 9', heading: district_9, cached_votes_up: 10)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      within "#budget_#{@budget.id}" do

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      budget_investment1 = create(:budget_investment, budget: @budget, title: "Hey ho",

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      expect(page).to have_content(@budget.name)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      district_9 = create(:budget_heading, group: @group, name: "District Nine")

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      mid_investment = create(:budget_investment, budget: @budget, title: 'Change district 9', heading: district_9, cached_votes_up: 10)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      unvoted_investment = create(:budget_investment, budget: @budget, heading: another_heading, title: 'Add new districts to the city')

Line is too long. [109/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

      expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']",

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

        expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']",

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      within "#budget_#{@budget.id}" do

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

    within "#budget_#{@budget.id}" do

Line is too long. [109/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

      expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']",

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

    @heading = create(:budget_heading, group: @group, name: "Health")

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      budget_investment1 = create(:budget_investment, budget: @budget, title: "Show me what you got")

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

    expect(page).to have_content(@budget.name)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

    budget_investment1 = create(:budget_investment, budget: @budget, title: "Show me what you got")

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      budget_investment = create(:budget_investment, budget: @budget, heading: @heading)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      within "#budget_#{@budget.id}" do

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      expect(page).to have_content(@budget.name)

Line is too long. [138/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

      top_investment = create(:budget_investment, budget: @budget, title: 'Destroy district 9', heading: district_9, cached_votes_up: 100)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

    @group = create(:budget_group, budget: @budget, name: 'Whole city')

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      within "#budget_#{@budget.id}" do

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

        expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']",

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

    budget_investment2 = create(:budget_investment, budget: @budget, title: "Get Schwifty")

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      budget_investment = create(:budget_investment, budget: @budget)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      expect(page).to have_content(@budget.name)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      low_investment = create(:budget_investment, budget: @budget, title: 'Nuke district 9', heading: district_9, cached_votes_up: 1)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      budget_investment = create(:budget_investment, budget: @budget, heading: @heading)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      expect(page).to have_content(@budget.name)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      expect(page).to have_content(@budget.name)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      budget_investment2 = create(:budget_investment, budget: @budget, title: "Get Schwifty")

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      expect(page).to have_content(@budget.name)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']",

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']",

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      16.times { create(:budget_investment, budget: @budget, heading: @heading) }

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

    before { @budget.update(phase: 'accepting') }

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      budget_investment2 = create(:budget_investment, budget: @budget, title: "Let's go",

Line is too long. [133/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

      low_investment = create(:budget_investment, budget: @budget, title: 'Nuke district 9', heading: district_9, cached_votes_up: 1)

Line is too long. [136/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

      unvoted_investment = create(:budget_investment, budget: @budget, heading: another_heading, title: 'Add new districts to the city')

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      top_investment = create(:budget_investment, budget: @budget, title: 'Destroy district 9', heading: district_9, cached_votes_up: 100)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      within "#budget_#{@budget.id}" do

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      16.times { create(:budget_investment, budget: @budget, heading: @heading) }

There are no issues that match your filters.

Category
Status