spec/features/votes_spec.rb

Summary

Maintainability
C
1 day
Test Coverage

File votes_spec.rb has 365 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rails_helper'

feature 'Votes' do

  background do
Severity: Minor
Found in spec/features/votes_spec.rb - About 4 hrs to fix

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

        scenario "Index shows user votes on proposals" do
          proposal1 = create(:proposal)
          proposal2 = create(:proposal)
          proposal3 = create(:proposal)
          create(:vote, voter: @manuela, votable: proposal1, vote_flag: true)
    Severity: Major
    Found in spec/features/votes_spec.rb and 1 other location - About 1 hr to fix
    spec/features/votes_spec.rb on lines 384..402

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

    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 "Index shows user votes on proposals" do
            spending_proposal1 = create(:spending_proposal)
            spending_proposal2 = create(:spending_proposal)
            spending_proposal3 = create(:spending_proposal)
            create(:vote, voter: @manuela, votable: spending_proposal1, vote_flag: true)
    Severity: Major
    Found in spec/features/votes_spec.rb and 1 other location - About 1 hr to fix
    spec/features/votes_spec.rb on lines 190..208

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

    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

          xscenario 'Trying to vote multiple times', :js do
            visit debate_path(create(:debate))
    
            find('.in-favor a').click
            expect(page).to have_content "1 vote"
    Severity: Minor
    Found in spec/features/votes_spec.rb and 1 other location - About 45 mins to fix
    spec/custom/features/votes_spec.rb on lines 15..28

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

    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

            within("#debate_#{debate2.id}_votes") do
              within(".in-favor") do
                expect(page).not_to have_css("a.voted")
                expect(page).not_to have_css("a.no-voted")
              end
    Severity: Minor
    Found in spec/features/votes_spec.rb and 2 other locations - About 35 mins to fix
    spec/features/votes_spec.rb on lines 24..32
    spec/features/votes_spec.rb on lines 48..56

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

    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

            within("#debate_#{debate1.id}_votes") do
              within(".in-favor") do
                expect(page).to have_css("a.voted")
                expect(page).not_to have_css("a.no-voted")
              end
    Severity: Minor
    Found in spec/features/votes_spec.rb and 2 other locations - About 35 mins to fix
    spec/features/votes_spec.rb on lines 36..44
    spec/features/votes_spec.rb on lines 48..56

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

    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

            within("#debate_#{debate3.id}_votes") do
              within(".in-favor") do
                expect(page).to have_css("a.no-voted")
                expect(page).not_to have_css("a.voted")
              end
    Severity: Minor
    Found in spec/features/votes_spec.rb and 2 other locations - About 35 mins to fix
    spec/features/votes_spec.rb on lines 24..32
    spec/features/votes_spec.rb on lines 36..44

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

    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 4 locations. Consider refactoring.
    Open

          scenario 'Trying to vote multiple times', :js do
            visit proposal_path(@proposal)
    
            within('.supports') do
              find('.in-favor a').click
    Severity: Minor
    Found in spec/features/votes_spec.rb and 3 other locations - About 15 mins to fix
    spec/features/votes_spec.rb on lines 245..252
    spec/features/votes_spec.rb on lines 430..437
    spec/features/votes_spec.rb on lines 441..448

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

    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 4 locations. Consider refactoring.
    Open

          scenario 'Create from proposal show', :js do
            visit proposal_path(@proposal)
    
            within('.supports') do
              find('.in-favor a').click
    Severity: Minor
    Found in spec/features/votes_spec.rb and 3 other locations - About 15 mins to fix
    spec/features/votes_spec.rb on lines 223..230
    spec/features/votes_spec.rb on lines 430..437
    spec/features/votes_spec.rb on lines 441..448

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

    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 4 locations. Consider refactoring.
    Open

          scenario 'Create from proposal show', :js do
            visit spending_proposal_path(@proposal)
    
            within('.supports') do
              find('.in-favor a').click
    Severity: Minor
    Found in spec/features/votes_spec.rb and 3 other locations - About 15 mins to fix
    spec/features/votes_spec.rb on lines 223..230
    spec/features/votes_spec.rb on lines 245..252
    spec/features/votes_spec.rb on lines 430..437

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

    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 4 locations. Consider refactoring.
    Open

          scenario 'Trying to vote multiple times', :js do
            visit spending_proposal_path(@proposal)
    
            within('.supports') do
              find('.in-favor a').click
    Severity: Minor
    Found in spec/features/votes_spec.rb and 3 other locations - About 15 mins to fix
    spec/features/votes_spec.rb on lines 223..230
    spec/features/votes_spec.rb on lines 245..252
    spec/features/votes_spec.rb on lines 441..448

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

    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

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

        background { login_as(@manuela) }
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

          create(:vote, voter: @manuela, votable: debate3, vote_flag: false)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            within("#proposal_#{@proposal.id}") do
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            create(:vote, voter: @pablo, votable: @proposal, vote_flag: true)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

        background { login_as(@manuela) }
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

          create(:vote, voter: @manuela, votable: proposal1, vote_flag: true)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            visit proposal_path(@proposal)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

          create(:vote, voter: @manuela, votable: debate1, vote_flag: true)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            create(:vote, voter: @manuela, votable: debate, vote_flag: true)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            create(:vote, voter: @pablo, votable: debate, vote_flag: false)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            create(:vote, voter: @manuela, votable: @proposal, vote_flag: true)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            create(:vote, voter: @manuela, votable: spending_proposal1, vote_flag: true)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

          login_as(@manuela)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            within("#proposal_#{@proposal.id}") do
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            visit proposal_path(@proposal)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            visit spending_proposal_path(@proposal)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            visit spending_proposal_path(@proposal)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            visit proposal_path(@proposal)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            visit proposal_path(@proposal)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            create(:vote, voter: @manuela, votable: @proposal, vote_flag: true)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            create(:vote, voter: @pablo, votable: @proposal, vote_flag: true)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

         login_as(@manuela)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

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

            visit spending_proposal_path(@proposal)
    Severity: Minor
    Found in spec/features/votes_spec.rb by rubocop

    There are no issues that match your filters.

    Category
    Status