From f29ca1aaa1e09b67650015b4b47bf1366ddec1f4 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Tue, 24 Dec 2024 16:09:40 +0200 Subject: [PATCH] Move test name to the class --- spec/model/atoms.rb | 6 +++++- spec/model/model_atoms_spec.rb | 10 ++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/spec/model/atoms.rb b/spec/model/atoms.rb index 9ec0066af..832ef9bb8 100644 --- a/spec/model/atoms.rb +++ b/spec/model/atoms.rb @@ -27,9 +27,13 @@ def skip? @skip end + def to_s(type = @type) + [@model, @desc, type].join(':') + end + def get_filename(type) ext = type == 'output' ? '.txt' : '.yaml' - [@model, @desc, type].join(':') + ext + to_s(type) + ext end def load_file(type = nil) diff --git a/spec/model/model_atoms_spec.rb b/spec/model/model_atoms_spec.rb index 615a1518c..1e3ad778f 100644 --- a/spec/model/model_atoms_spec.rb +++ b/spec/model/model_atoms_spec.rb @@ -2,20 +2,18 @@ describe 'ATOMS tests' do ATOMS.get.each do |test| - test_string = "#{test.type}:#{test.model}:#{test.desc}" - before { init_model_helper } if test.type == 'output' - it "#{test_string} has expected output" do - skip("check simulation+output data file for #{test_string}") if test.skip? + it "#{test} has expected output" do + skip("check simulation+output data file for #{test}") if test.skip? cfg = MockSsh.get_result(self, test).to_cfg _(cfg).must_match test.output end elsif test.type == 'prompt' - it "#{test_string} has working prompt detection" do - skip("check prompt data file for #{test_string}") if test.skip? + it "#{test} has working prompt detection" do + skip("check prompt data file for #{test}") if test.skip? @node = MockSsh.get_node(test.model) class_sym = Object.constants.find { |const| const.to_s.casecmp(test.model).zero? } prompt_re = Object.const_get(class_sym).prompt