scottwillson/racing_on_rails

View on GitHub
test/models/person_test.rb

Summary

Maintainability
F
5 days
Test Coverage

File person_test.rb has 1097 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "test_helper"

# :stopdoc:
class PersonTest < ActiveSupport::TestCase
  test "save" do
Severity: Major
Found in test/models/person_test.rb - About 2 days to fix

    Method assert_renew has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def assert_renew(now, member_from, member_to, expected_member_from, expected_member_to)
    Severity: Minor
    Found in test/models/person_test.rb - About 35 mins to fix

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

            person.member_from = Time.zone.local(2001, 1, 1)
            person.member_to = Time.zone.local(2001, 12, 31)
            assert_equal(false, person.member?, "member?")
            assert_equal(false, person.member?(Time.zone.local(2000, 12, 31)), "member")
            assert_equal(true, person.member?(Time.zone.local(2001, 1, 1)), "member")
      Severity: Major
      Found in test/models/person_test.rb and 1 other location - About 2 hrs to fix
      test/models/person_test.rb on lines 389..399

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

      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

            person.member_from = Time.zone.local(2001, 1, 1)
            person.member_to = Time.zone.local(2001, 12, 31)
            assert_equal(false, person.member?, "member?")
            assert_equal(false, person.member?(Time.zone.local(2000, 12, 31)), "member")
            assert_equal(true, person.member?(Time.zone.local(2001, 1, 1)), "member")
      Severity: Major
      Found in test/models/person_test.rb and 1 other location - About 2 hrs to fix
      test/models/person_test.rb on lines 403..413

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

      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

        test "racing age" do
          person = Person.new
          assert_nil(person.racing_age)
      
          person.date_of_birth = 29.years.ago
      Severity: Major
      Found in test/models/person_test.rb and 1 other location - About 2 hrs to fix
      test/models/person_test.rb on lines 636..653

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

      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

        test "cyclocross racing age" do
          person = Person.new
          assert_nil(person.cyclocross_racing_age)
      
          person.date_of_birth = 29.years.ago
      Severity: Major
      Found in test/models/person_test.rb and 1 other location - About 2 hrs to fix
      test/models/person_test.rb on lines 616..633

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

      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

        test "create and override alias" do
          person = FactoryBot.create(:person, name: "Molly Cameron")
          person.aliases.create!(name: "Mollie Cameron")
      
          assert_not_nil(Person.find_by(name: "Molly Cameron"), "Molly Cameron should exist")
      Severity: Major
      Found in test/models/person_test.rb and 1 other location - About 1 hr to fix
      test/models/teams/name_test.rb on lines 191..204

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

      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

        test "member to from before to after" do
          person = Person.new(first_name: "Dario", last_name: "Frederick")
          person.member_from = Date.new(1970, 1, 1)
          person.member_to = Date.new(1985, 12, 31)
          person.member_to = Date.new(1971, 7, 31)
      Severity: Major
      Found in test/models/person_test.rb and 2 other locations - About 1 hr to fix
      test/models/person_test.rb on lines 506..518
      test/models/person_test.rb on lines 536..548

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

      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

        test "member to from after to after" do
          person = Person.new(first_name: "Dario", last_name: "Frederick")
          person.member_from = Date.new(2006, 1, 1)
          person.member_to = Date.new(2006, 12, 31)
          person.member_to = Date.new(2000, 1, 31)
      Severity: Major
      Found in test/models/person_test.rb and 2 other locations - About 1 hr to fix
      test/models/person_test.rb on lines 506..518
      test/models/person_test.rb on lines 521..533

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

      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

        test "member to from before to before" do
          person = Person.new(first_name: "Dario", last_name: "Frederick")
          person.member_from = Date.new(1970, 1, 1)
          person.member_to = Date.new(1970, 12, 31)
          person.member_to = Date.new(1971, 7, 31)
      Severity: Major
      Found in test/models/person_test.rb and 2 other locations - About 1 hr to fix
      test/models/person_test.rb on lines 521..533
      test/models/person_test.rb on lines 536..548

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

      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

        test "date" do
          person = Person.new(date_of_birth: "0073-10-04")
          assert_equal_dates("1973-10-04", person.date_of_birth, "date_of_birth from 0073-10-04")
      
          person = Person.new(date_of_birth: "10/27/78")
      Severity: Minor
      Found in test/models/person_test.rb and 1 other location - About 40 mins to fix
      test/models/category_test.rb on lines 80..88

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

      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

        test "administrator" do
          administrator = FactoryBot.create(:administrator)
          promoter = FactoryBot.create(:promoter)
          member = FactoryBot.create(:person)
      
      
      Severity: Minor
      Found in test/models/person_test.rb and 1 other location - About 20 mins to fix
      test/models/person_test.rb on lines 1106..1113

      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

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

        test "promoter" do
          administrator = FactoryBot.create(:administrator)
          promoter = FactoryBot.create(:promoter)
          member = FactoryBot.create(:person)
      
      
      Severity: Minor
      Found in test/models/person_test.rb and 1 other location - About 20 mins to fix
      test/models/person_test.rb on lines 1096..1103

      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

      There are no issues that match your filters.

      Category
      Status