Skip to content

Commit

Permalink
Move test name to the class
Browse files Browse the repository at this point in the history
  • Loading branch information
ytti committed Dec 24, 2024
1 parent 35f16b6 commit f29ca1a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 5 additions & 1 deletion spec/model/atoms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 4 additions & 6 deletions spec/model/model_atoms_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f29ca1a

Please sign in to comment.