I am trying to understand these three principles better.
My question is... How do I write tests without violating SRP, OCP, and DRY?
My current design violates DRY because of the similar code in the test files.
I can't merge the test files together because that will violate the Open/Closed principle. (There is a high probability of adding more modules later)
Is there something I'm missing here? If it helps I'm using Ruby and Minitest for this.
Module files
a.rb:
module A
# does an algorithm
end
b.rb:
module B
#does another algorithm
end
Test files
a_test.rb:
class ModuleATest
# tests the algorithm
end
b_test.rb:
class ModuleBTest
# tests the algorithm
end