|
43 | 43 | finder = instance_double(DiscourseAi::InferredConcepts::Finder) |
44 | 44 | allow(DiscourseAi::InferredConcepts::Finder).to receive(:new).and_return(finder) |
45 | 45 |
|
46 | | - allow(finder).to receive(:identify_concepts).with( |
47 | | - content, |
48 | | - ).and_return(%w[ruby programming]) |
| 46 | + allow(finder).to receive(:identify_concepts).with(content).and_return(%w[ruby programming]) |
49 | 47 |
|
50 | | - allow(finder).to receive(:create_or_find_concepts).with( |
51 | | - %w[ruby programming], |
52 | | - ).and_return([concept1]) |
| 48 | + allow(finder).to receive(:create_or_find_concepts).with(%w[ruby programming]).and_return( |
| 49 | + [concept1], |
| 50 | + ) |
53 | 51 |
|
54 | 52 | result = manager.generate_concepts_from_content(content) |
55 | 53 | expect(result).to eq([concept1]) |
|
65 | 63 | applier = instance_double(DiscourseAi::InferredConcepts::Applier) |
66 | 64 | allow(DiscourseAi::InferredConcepts::Applier).to receive(:new).and_return(applier) |
67 | 65 |
|
68 | | - allow(applier).to receive(:topic_content_for_analysis).with( |
69 | | - topic, |
70 | | - ).and_return("topic content") |
| 66 | + allow(applier).to receive(:topic_content_for_analysis).with(topic).and_return("topic content") |
71 | 67 |
|
72 | | - allow(manager).to receive(:generate_concepts_from_content).with( |
73 | | - "topic content", |
74 | | - ).and_return([concept1]) |
| 68 | + allow(manager).to receive(:generate_concepts_from_content).with("topic content").and_return( |
| 69 | + [concept1], |
| 70 | + ) |
75 | 71 |
|
76 | 72 | result = manager.generate_concepts_from_topic(topic) |
77 | 73 | expect(result).to eq([concept1]) |
|
87 | 83 | applier = instance_double(DiscourseAi::InferredConcepts::Applier) |
88 | 84 | allow(DiscourseAi::InferredConcepts::Applier).to receive(:new).and_return(applier) |
89 | 85 |
|
90 | | - allow(applier).to receive(:post_content_for_analysis).with( |
91 | | - post, |
92 | | - ).and_return("post content") |
| 86 | + allow(applier).to receive(:post_content_for_analysis).with(post).and_return("post content") |
93 | 87 |
|
94 | | - allow(manager).to receive(:generate_concepts_from_content).with( |
95 | | - "post content", |
96 | | - ).and_return([concept1]) |
| 88 | + allow(manager).to receive(:generate_concepts_from_content).with("post content").and_return( |
| 89 | + [concept1], |
| 90 | + ) |
97 | 91 |
|
98 | 92 | result = manager.generate_concepts_from_post(post) |
99 | 93 | expect(result).to eq([concept1]) |
|
109 | 103 | applier = instance_double(DiscourseAi::InferredConcepts::Applier) |
110 | 104 | allow(DiscourseAi::InferredConcepts::Applier).to receive(:new).and_return(applier) |
111 | 105 |
|
112 | | - allow(applier).to receive(:match_existing_concepts).with( |
113 | | - topic, |
114 | | - ).and_return([concept1]) |
| 106 | + allow(applier).to receive(:match_existing_concepts).with(topic).and_return([concept1]) |
115 | 107 |
|
116 | 108 | result = manager.match_topic_to_concepts(topic) |
117 | 109 | expect(result).to eq([concept1]) |
|
127 | 119 | applier = instance_double(DiscourseAi::InferredConcepts::Applier) |
128 | 120 | allow(DiscourseAi::InferredConcepts::Applier).to receive(:new).and_return(applier) |
129 | 121 |
|
130 | | - allow(applier).to receive( |
131 | | - :match_existing_concepts_for_post, |
132 | | - ).with(post).and_return([concept1]) |
| 122 | + allow(applier).to receive(:match_existing_concepts_for_post).with(post).and_return([concept1]) |
133 | 123 |
|
134 | 124 | result = manager.match_post_to_concepts(post) |
135 | 125 | expect(result).to eq([concept1]) |
|
195 | 185 | finder = instance_double(DiscourseAi::InferredConcepts::Finder) |
196 | 186 | allow(DiscourseAi::InferredConcepts::Finder).to receive(:new).and_return(finder) |
197 | 187 |
|
198 | | - allow(finder).to receive(:find_candidate_topics).with( |
199 | | - **opts, |
200 | | - ).and_return([topic]) |
| 188 | + allow(finder).to receive(:find_candidate_topics).with(**opts).and_return([topic]) |
201 | 189 |
|
202 | 190 | result = manager.find_candidate_topics(opts) |
203 | 191 | expect(result).to eq([topic]) |
|
210 | 198 | finder = instance_double(DiscourseAi::InferredConcepts::Finder) |
211 | 199 | allow(DiscourseAi::InferredConcepts::Finder).to receive(:new).and_return(finder) |
212 | 200 |
|
213 | | - allow(finder).to receive(:find_candidate_posts).with( |
214 | | - **opts, |
215 | | - ).and_return([post]) |
| 201 | + allow(finder).to receive(:find_candidate_posts).with(**opts).and_return([post]) |
216 | 202 |
|
217 | 203 | result = manager.find_candidate_posts(opts) |
218 | 204 | expect(result).to eq([post]) |
|
231 | 217 | finder = instance_double(DiscourseAi::InferredConcepts::Finder) |
232 | 218 | allow(DiscourseAi::InferredConcepts::Finder).to receive(:new).and_return(finder) |
233 | 219 |
|
234 | | - allow(finder).to receive(:deduplicate_concepts).at_least( |
235 | | - :once, |
236 | | - ).and_return(%w[apple banana cat dog]) |
| 220 | + allow(finder).to receive(:deduplicate_concepts).at_least(:once).and_return( |
| 221 | + %w[apple banana cat dog], |
| 222 | + ) |
237 | 223 |
|
238 | 224 | allow(InferredConcept).to receive(:where).and_call_original |
239 | 225 | allow(InferredConcept).to receive(:insert_all).and_call_original |
|
0 commit comments