|
34 | 34 | allowed_group_ids: [], |
35 | 35 | ) |
36 | 36 |
|
| 37 | + Fabricate(:ai_tool, id: 1) |
| 38 | + Fabricate(:ai_tool, id: 2, name: "Archie search", tool_name: "search") |
| 39 | + |
37 | 40 | expect(persona.valid?).to eq(true) |
38 | 41 |
|
39 | | - persona.tools = [["test-1", { test: "test" }, false]] |
| 42 | + persona.tools = %w[search image_generation] |
40 | 43 | expect(persona.valid?).to eq(true) |
41 | 44 |
|
42 | | - persona.tools = [["test-1", { test: "test" }, false], ["test-1", { test: "test" }, false]] |
| 45 | + persona.tools = %w[search image_generation search] |
43 | 46 | expect(persona.valid?).to eq(false) |
44 | 47 | expect(persona.errors[:tools]).to eq(["Can not have duplicate tools"]) |
45 | 48 |
|
46 | | - persona.tools = [["test-1", { test: "test" }, false], ["test-2", { test: "test" }, false]] |
| 49 | + persona.tools = [["custom-1", { test: "test" }, false], ["custom-2", { test: "test" }, false]] |
47 | 50 | expect(persona.valid?).to eq(true) |
| 51 | + expect(persona.errors[:tools]).to eq([]) |
| 52 | + |
| 53 | + persona.tools = [["custom-1", { test: "test" }, false], ["custom-1", { test: "test" }, false]] |
| 54 | + expect(persona.valid?).to eq(false) |
| 55 | + expect(persona.errors[:tools]).to eq(["Can not have duplicate tools"]) |
| 56 | + |
| 57 | + persona.tools = [ |
| 58 | + ["custom-1", { test: "test" }, false], |
| 59 | + ["custom-2", { test: "test" }, false], |
| 60 | + "image_generation", |
| 61 | + ] |
| 62 | + expect(persona.valid?).to eq(true) |
| 63 | + expect(persona.errors[:tools]).to eq([]) |
| 64 | + |
| 65 | + persona.tools = [ |
| 66 | + ["custom-1", { test: "test" }, false], |
| 67 | + ["custom-2", { test: "test" }, false], |
| 68 | + "Search", |
| 69 | + ] |
| 70 | + expect(persona.valid?).to eq(false) |
| 71 | + expect(persona.errors[:tools]).to eq(["Can not have duplicate tools"]) |
48 | 72 | end |
49 | 73 |
|
50 | 74 | it "allows creation of user" do |
|
0 commit comments