Skip to content

Commit

Permalink
Fix prompt test
Browse files Browse the repository at this point in the history
  • Loading branch information
ytti committed Dec 21, 2024
1 parent 09a0afb commit ea7052f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions spec/model/model_atoms_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def self.tests_get
tests[:output] << TestOutput.new(model, desc)
end

Dir[File.join(DIRECTORY, '*:prompt.txt')].each do |file|
model, desc, _type = *File.basename(file, '.txt').split(':')
Dir[File.join(DIRECTORY, '*:prompt.yaml')].each do |file|
model, desc, _type = *File.basename(file, '.yaml').split(':')
tests[:prompt] << TestPrompt.new(model, desc)
end

Expand Down Expand Up @@ -84,8 +84,11 @@ def initialize(model, desc)
tests[:output].each do |test|
next if test.skip?

it "ATOMS ('#{test.model}' / '#{test.desc}') has expected output" do
before(:each) do
init_model_helper
end

it "ATOMS ('#{test.model}' / '#{test.desc}') has expected output" do
@node = Oxidized::Node.new(name: 'example.com',
input: 'ssh',
model: test.model)
Expand All @@ -100,8 +103,8 @@ def initialize(model, desc)
tests[:prompt].each do |test|
next if test.skip?

prompt_re = Object.const_get(test.model.upcase).prompt
it "ATOMS ('#{test.model}' / '#{test.desc}') has working prompt detection" do
prompt_re = Object.const_get(test.model.upcase).prompt
test.data['pass']&.each do |want_pass|
_(want_pass).must_match prompt_re
end
Expand Down

0 comments on commit ea7052f

Please sign in to comment.