In fact, we want the UUID to be unique.. how test to ensure that?
Should we be testing the algorithm too? Or just only UUID != null?
# it 'must have a unique uuid' do
# # TODO: A uniqueness test on the UUID.
# # create a Project with a known UUID -> use chronic to stick Time.now? but
# # that's Project implementation specific. it would be nice to hijack the
# # object and change the random UUID generate.
# end
Test classes
Why ::Rails::Model, instead of ::AR::Model? Fixture glue is a railtie?
Why ::Rails::Model, instead of Minitest::Spec? Fixture glue is a railtie?
DB state during testing
Q: What about "after do ; @project.save ; end' to be sure the record always saves? Would this slow down the testsuite?
Use Factories in "before do" ? Or, ruby def setup ; end ; def teardown ; end ;?
class ProjectTest < MiniTest::Rails::Model
...
end
The following tests really need before/after setup/teardown to insure objects are in the DB but are also properly removed at the end of the testcase (to avoid leakage to other tests when randomized).
This feels wrong. The testsuite is now dependent on the DB state.
What if another test creates a Collaboration? :/
it 'should delete collaborations when deleted' do
...
end
it 'should not delete users when deleted' do
...
end
UUID testing
Test classes
DB state during testing
Q: What about "after do ; @project.save ; end' to be sure the record always saves? Would this slow down the testsuite? Use Factories in "before do" ? Or,
ruby def setup ; end ; def teardown ; end ;
?The following tests really need before/after setup/teardown to insure objects are in the DB but are also properly removed at the end of the testcase (to avoid leakage to other tests when randomized).