Repository navigation
Replies: 2 comments
|
Test the public result of the declaration rather than expecting the macro call itself. For example, assert the configured association’s Generated by Copilot Triage using |
|
RSpec.describe Chat, type: :model do
it "is a RubyLLM chat" do
expect(Chat.ancestors).to include(RubyLLM::ActiveRecord::ChatMethods)
expect(Chat.messages_association_name).to eq(:messages)
expect(Chat.message_class).to eq("Message")
end
it "has the messages association" do
reflection = Chat.reflect_on_association(:messages)
expect(reflection.macro).to eq(:has_many)
expect(reflection.klass).to eq(Message)
end
it { expect(Chat.new).to respond_to(:ask) }
endIf you pass custom options ( |
Uh oh!
There was an error while loading. Please reload this page.
What do you recommend for an rspec/models spec of the chat model that I generate for my rails application. I would like to test that it calls acts_as_chat with the expected messages and message_class, so that future me or other devs do not remove this from the model.
All reactions