diff --git a/test/test_helper.rb b/test/test_helper.rb index e4efa3d..8be61d6 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -10,6 +10,7 @@ require 'minitest/mock' require 'active_support/inflector' # For pluralization utility + class ActiveSupport::TestCase include GlobalHelpers diff --git a/test/unit/concerns/versionable_test.rb b/test/unit/concerns/versionable_test.rb index 429b680..781cfd6 100644 --- a/test/unit/concerns/versionable_test.rb +++ b/test/unit/concerns/versionable_test.rb @@ -67,9 +67,14 @@ test "#find_in_space looks for the object in the relation" do # Looking for section - section = init_section(@template.phases.first) - assert_equal(@template.phases.first.sections.first, - find_in_space(section, @template.phases), 'section found in the space through its phase number') + @template = Template.create!(title: "New test template", org: Org.create(name: "Gavin's org")) + @phase = @template.phases.create!(title: "New test phase", number: 1) + @section = init_section(@phase, number: rand(10_000)) + @found_section = find_in_space(@section, @template.phases) + @templ_section = @phase.sections.first + assert_equal(@found_section, @templ_section, + 'section found in the space through its phase number') + # Looking for question question = init_question(@template.phases.first.sections.first) assert_equal(@template.phases.first.sections.first.questions.first,