Skip to content

Commit

Permalink
add test for a prompt with locals
Browse files Browse the repository at this point in the history
  • Loading branch information
evdevdev committed Aug 28, 2024
1 parent ef24f73 commit 733fb18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/action_prompt/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ class ActionPrompt::BaseTest < ActiveSupport::TestCase
result = ActionPrompt.render("hello_world")
assert_equal "You are a helpful assistant who replies with, \"Hello, world!\"", result
end

test "a template with a variable" do
result = ActionPrompt.render("hello_somebody", locals: { name: "John" })
assert_equal "You are a helpful assistant who replies with, \"Hello, John!\"", result
end
end
1 change: 1 addition & 0 deletions test/dummy/app/prompts/hello_somebody.text.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
You are a helpful assistant who replies with, "Hello, <%= name %>!"

0 comments on commit 733fb18

Please sign in to comment.