spec/features/polls/polls_spec.rb

Summary

Maintainability
C
1 day
Test Coverage

File polls_spec.rb has 368 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rails_helper'

feature 'Polls' do

  context "Concerns" do
Severity: Minor
Found in spec/features/polls/polls_spec.rb - About 4 hrs to fix

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

        scenario 'Level 2 users in an incoming poll' do
          incoming_poll = create(:poll, :incoming, geozone_restricted: true)
          incoming_poll.geozones << geozone
    
          question = create(:poll_question, poll: incoming_poll)
    Severity: Major
    Found in spec/features/polls/polls_spec.rb and 1 other location - About 1 hr to fix
    spec/features/polls/polls_spec.rb on lines 233..250

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

    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 'Level 2 users in an expired poll' do
          expired_poll = create(:poll, :expired, geozone_restricted: true)
          expired_poll.geozones << geozone
    
          question = create(:poll_question, poll: expired_poll)
    Severity: Major
    Found in spec/features/polls/polls_spec.rb and 1 other location - About 1 hr to fix
    spec/features/polls/polls_spec.rb on lines 213..230

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

    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 "Current filter is properly highlighted" do
          visit polls_path
          expect(page).not_to have_link('Open')
          expect(page).to have_link('Incoming')
          expect(page).to have_link('Expired')
    Severity: Major
    Found in spec/features/polls/polls_spec.rb and 1 other location - About 1 hr to fix
    spec/features/admin/hidden_budget_investments_spec.rb on lines 70..84

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

    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 "Show poll results and stats if enabled and poll expired" do
          poll = create(:poll, :expired, results_enabled: true, stats_enabled: true)
          user = create(:user)
    
          login_as user
    Severity: Minor
    Found in spec/features/polls/polls_spec.rb and 1 other location - About 1 hr to fix
    spec/features/polls/polls_spec.rb on lines 472..486

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

    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 "Don't show poll results and stats if is not expired" do
          poll = create(:poll, :current, results_enabled: true, stats_enabled: true)
          user = create(:user)
    
          login_as user
    Severity: Minor
    Found in spec/features/polls/polls_spec.rb and 1 other location - About 1 hr to fix
    spec/features/polls/polls_spec.rb on lines 438..452

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

    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. [105/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
    Open

          expect(page).to have_content("You do not have permission to carry out the action 'stats' on poll.")
    Severity: Minor
    Found in spec/features/polls/polls_spec.rb by rubocop

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

          create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment, date: Date.current)
    Severity: Minor
    Found in spec/features/polls/polls_spec.rb by rubocop

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

          expect(page).to have_content("You do not have permission to carry out the action 'results' on poll.")
    Severity: Minor
    Found in spec/features/polls/polls_spec.rb by rubocop

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

          video = create(:poll_answer_video, answer: answer, title: "Awesome project video", url: "https://www.youtube.com/watch?v=123")
    Severity: Minor
    Found in spec/features/polls/polls_spec.rb by rubocop

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

          expect(page).to have_link("Awesome project video", href: "https://www.youtube.com/watch?v=123")
    Severity: Minor
    Found in spec/features/polls/polls_spec.rb by rubocop

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

          expect(page).to have_content("You do not have permission to carry out the action 'stats' on poll.")
    Severity: Minor
    Found in spec/features/polls/polls_spec.rb by rubocop

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

          expect(page).to have_content("You do not have permission to carry out the action 'results' on poll.")
    Severity: Minor
    Found in spec/features/polls/polls_spec.rb by rubocop

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

          expect(page).to have_content "You have already participated in a physical booth. You can not participate again."
    Severity: Minor
    Found in spec/features/polls/polls_spec.rb by rubocop

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

        let(:poll) { create(:poll, summary: "Summary", description: "Description", starts_at: '2017-12-01', ends_at: '2018-02-01') }
    Severity: Minor
    Found in spec/features/polls/polls_spec.rb by rubocop

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

          create(:poll_shift, officer: officer, booth: booth, date: Date.current, task: :vote_collection)
    Severity: Minor
    Found in spec/features/polls/polls_spec.rb by rubocop

    There are no issues that match your filters.

    Category
    Status