|
10 | 10 | describe "migration templates" do
|
11 | 11 | it "has expected migration template files" do
|
12 | 12 | expected_files = [
|
13 |
| - "create_chats_migration.rb", |
14 |
| - "create_messages_migration.rb", |
15 |
| - "create_tool_calls_migration.rb" |
| 13 | + "create_chats_migration.rb.tt", |
| 14 | + "create_messages_migration.rb.tt", |
| 15 | + "create_tool_calls_migration.rb.tt" |
16 | 16 | ]
|
17 | 17 |
|
18 | 18 | expected_files.each do |file|
|
|
21 | 21 | end
|
22 | 22 |
|
23 | 23 | it "has proper migration content" do
|
24 |
| - chat_migration = File.read(File.join(template_dir, "create_chats_migration.rb")) |
| 24 | + chat_migration = File.read(File.join(template_dir, "create_chats_migration.rb.tt")) |
25 | 25 | expect(chat_migration).to include("create_table :chats")
|
26 | 26 | expect(chat_migration).to include("t.string :model_id")
|
27 | 27 |
|
28 |
| - message_migration = File.read(File.join(template_dir, "create_messages_migration.rb")) |
| 28 | + message_migration = File.read(File.join(template_dir, "create_messages_migration.rb.tt")) |
29 | 29 | expect(message_migration).to include("create_table :messages")
|
30 | 30 | expect(message_migration).to include("t.references :chat")
|
31 | 31 | expect(message_migration).to include("t.string :role")
|
32 | 32 | expect(message_migration).to include("t.text :content")
|
33 | 33 | expect(message_migration).to include("t.references :tool_call")
|
34 | 34 |
|
35 |
| - tool_call_migration = File.read(File.join(template_dir, "create_tool_calls_migration.rb")) |
| 35 | + tool_call_migration = File.read(File.join(template_dir, "create_tool_calls_migration.rb.tt")) |
36 | 36 | expect(tool_call_migration).to include("create_table :tool_calls")
|
37 |
| - expect(tool_call_migration).to include("# No reference to message to avoid circular references") |
38 | 37 | expect(tool_call_migration).to include("t.string :tool_call_id")
|
39 | 38 | expect(tool_call_migration).to include("t.string :name")
|
40 | 39 |
|
|
50 | 49 | describe "model templates" do
|
51 | 50 | it "has expected model template files" do
|
52 | 51 | expected_files = [
|
53 |
| - "chat_model.rb", |
54 |
| - "message_model.rb", |
55 |
| - "tool_call_model.rb" |
| 52 | + "chat_model.rb.tt", |
| 53 | + "message_model.rb.tt", |
| 54 | + "tool_call_model.rb.tt" |
56 | 55 | ]
|
57 | 56 |
|
58 | 57 | expected_files.each do |file|
|
|
61 | 60 | end
|
62 | 61 |
|
63 | 62 | it "has proper acts_as declarations in model templates" do
|
64 |
| - chat_content = File.read(File.join(template_dir, "chat_model.rb")) |
| 63 | + chat_content = File.read(File.join(template_dir, "chat_model.rb.tt")) |
65 | 64 | expect(chat_content).to include("acts_as_chat")
|
66 | 65 |
|
67 |
| - message_content = File.read(File.join(template_dir, "message_model.rb")) |
| 66 | + message_content = File.read(File.join(template_dir, "message_model.rb.tt")) |
68 | 67 | expect(message_content).to include("acts_as_message")
|
69 | 68 |
|
70 |
| - tool_call_content = File.read(File.join(template_dir, "tool_call_model.rb")) |
| 69 | + tool_call_content = File.read(File.join(template_dir, "tool_call_model.rb.tt")) |
71 | 70 | expect(tool_call_content).to include("acts_as_tool_call")
|
72 | 71 | end
|
73 | 72 | end
|
74 | 73 |
|
75 | 74 | describe "initializer template" do
|
76 | 75 | it "has expected initializer template file" do
|
77 |
| - expect(File.exist?(File.join(template_dir, "initializer.rb"))).to be(true) |
| 76 | + expect(File.exist?(File.join(template_dir, "initializer.rb.tt"))).to be(true) |
78 | 77 | end
|
79 | 78 |
|
80 | 79 | it "has proper configuration content" do
|
81 |
| - initializer_content = File.read(File.join(template_dir, "initializer.rb")) |
| 80 | + initializer_content = File.read(File.join(template_dir, "initializer.rb.tt")) |
82 | 81 | expect(initializer_content).to include("RubyLLM.configure do |config|")
|
83 | 82 | expect(initializer_content).to include("config.openai_api_key")
|
84 | 83 | expect(initializer_content).to include("ENV[\"OPENAI_API_KEY\"]")
|
|
0 commit comments