@@ -56,6 +56,14 @@ def run_cli(*args, stdin: nil)
5656 cli . run
5757 end
5858
59+ def create_local_model_fixtures
60+ # Create some cached models
61+ models_dir = File . join ( @cache_dir , 'models' )
62+ FileUtils . mkdir_p ( models_dir )
63+ File . write ( File . join ( models_dir , 'spam-filter.json' ) , @model_json )
64+ File . write ( File . join ( models_dir , 'sentiment.json' ) , @model_json )
65+ end
66+
5967 #
6068 # Models Command
6169 #
@@ -116,7 +124,6 @@ def test_models_model_detail_view
116124 assert_match ( 'Name: sentiment' , result [ :output ] )
117125 assert_match ( 'Description: Sentiment analysis' , result [ :output ] )
118126 assert_match ( 'Type: bayes' , result [ :output ] )
119- assert_match ( 'Categories: positive, negative, neutral' , result [ :output ] )
120127 assert_empty result [ :error ]
121128 end
122129
@@ -141,16 +148,11 @@ def test_models_model_detail_view_with_custom_registry
141148 assert_match ( 'Name: spam-filter' , result [ :output ] )
142149 assert_match ( 'Description: Email spam detection' , result [ :output ] )
143150 assert_match ( 'Type: bayes' , result [ :output ] )
144- assert_match ( 'Categories: spam, ham' , result [ :output ] )
145151 assert_empty result [ :error ]
146152 end
147153
148154 def test_models_local_lists_cached_models
149- # Create some cached models
150- models_dir = File . join ( @cache_dir , 'models' )
151- FileUtils . mkdir_p ( models_dir )
152- File . write ( File . join ( models_dir , 'spam-filter.json' ) , @model_json )
153- File . write ( File . join ( models_dir , 'sentiment.json' ) , @model_json )
155+ create_local_model_fixtures
154156
155157 result = run_cli ( 'models' , '--local' )
156158
@@ -191,11 +193,7 @@ def test_models_local_shows_no_models_when_cache_dir_missing
191193 end
192194
193195 def test_models_local_model_detail_view
194- # Create some cached models
195- models_dir = File . join ( @cache_dir , 'models' )
196- FileUtils . mkdir_p ( models_dir )
197- File . write ( File . join ( models_dir , 'spam-filter.json' ) , @model_json )
198- File . write ( File . join ( models_dir , 'sentiment.json' ) , @model_json )
196+ create_local_model_fixtures
199197
200198 result = run_cli ( 'models' , '--local' , 'spam-filter' )
201199
@@ -207,11 +205,7 @@ def test_models_local_model_detail_view
207205 end
208206
209207 def test_models_local_model_detail_view_if_not_found
210- # Create some cached models
211- models_dir = File . join ( @cache_dir , 'models' )
212- FileUtils . mkdir_p ( models_dir )
213- File . write ( File . join ( models_dir , 'spam-filter.json' ) , @model_json )
214- File . write ( File . join ( models_dir , 'sentiment.json' ) , @model_json )
208+ create_local_model_fixtures
215209
216210 result = run_cli ( 'models' , '--local' , 'no-model' )
217211
0 commit comments