[ranch] 54: Update unit tests.

https://svn.lrde.epita.fr/svn/ranch/trunk Index: ChangeLog from Nicolas Despr�s <nicolas.despres@gmail.com> Update unit tests. * web/ranch/test/unit/project_test.rb, * web/ranch/test/unit/output_test.rb, * web/ranch/test/unit/bench_test.rb: Assert fixtures are correct and ensure other tests stress only the expected validation rule. * web/ranch/test/fixtures/outputs.yml: system_id is zero and not one. fixtures/outputs.yml | 2 +- unit/bench_test.rb | 14 ++++++++++++-- unit/output_test.rb | 17 ++++++++++++++--- unit/project_test.rb | 8 ++++++++ 4 files changed, 35 insertions(+), 6 deletions(-) Index: web/ranch/test/fixtures/outputs.yml --- web/ranch/test/fixtures/outputs.yml (revision 53) +++ web/ranch/test/fixtures/outputs.yml (working copy) @@ -23,7 +23,7 @@ bench_id: <%= 1 %> arg_num: <%= arg_num += 1 %> set_num: <%= set_num %> - system_id: 0 + system_id: 1 revision: <%= rev %> <% end %> Index: web/ranch/test/unit/project_test.rb --- web/ranch/test/unit/project_test.rb (revision 53) +++ web/ranch/test/unit/project_test.rb (working copy) @@ -7,6 +7,14 @@ assert Project.new.save end + def test_save_fixtures + Project.find_all.each do |project| + assert(project.save, + "cannot save #{project.name}: " + + project.errors.full_messages.inspect) + end + end + def test_save_bad_head_revision_not_numeric foo = Project.new(:name => 'foo', :head_revision => 'foo') assert ! foo.save Index: web/ranch/test/unit/output_test.rb --- web/ranch/test/unit/output_test.rb (revision 53) +++ web/ranch/test/unit/output_test.rb (working copy) @@ -7,18 +7,29 @@ assert Output.new.save end + def test_save_fixtures + Output.find_all.each do |output| + assert(output.save, + "cannot save #{output.name}: " + + output.errors.full_messages.inspect) + end + end + def test_save_arg_num_is_positive - output = Output.new(:arg_num => -1) + output = outputs("determinize_r1_utime_1") + output.arg_num = -1 assert !output.save end def test_save_set_num_is_positive_or_zero - output = Output.new(:set_num => -1) + output = outputs("determinize_r1_utime_1") + output.set_num = -1 assert !output.save end def test_save_presence_of_revision - output = Output.new(:name => 'foo', :revision => 0) + output = outputs("determinize_r1_utime_1") + output.revision = 0 assert !output.save end Index: web/ranch/test/unit/bench_test.rb --- web/ranch/test/unit/bench_test.rb (revision 53) +++ web/ranch/test/unit/bench_test.rb (working copy) @@ -7,13 +7,23 @@ assert Bench.new.save end + def test_save_fixtures + Bench.find_all.each do |bench| + assert(bench.save, + "cannot save #{bench.name}: " + + bench.errors.full_messages.inspect) + end + end + def test_save_presence_of_name - bench = Bench.new(:name => '') + bench = benches("determinize") + bench.name = '' assert !bench.save end def test_save_maximum_lenght_of_name - bench = Bench.new(:name => '' * 256) + bench = benches("open") + bench.name = '' * 256 assert !bench.save end
participants (1)
-
Nicolas Despr�s