diff options
author | Matt Jankowski <mjankowski@thoughtbot.com> | 2017-04-09 08:45:01 -0400 |
---|---|---|
committer | Eugen <eugen@zeonfederated.com> | 2017-04-09 14:45:01 +0200 |
commit | 388ec0d5b6d1549abed15802d6bdbfc8b1c05294 (patch) | |
tree | 218a713f7bd177f964f44a4c3fe0092bddfc5382 /spec/models/tag_spec.rb | |
parent | 71706f21c28f5ae623ee69810fe26a34fb79b446 (diff) |
Search cleanup (#1333)
* Clean up SQL output in Tag and Account search methods * Add basic coverage for Tag.search_for * Add coverage for Account.search_for * Add coverage for Account.advanced_search_for
Diffstat (limited to 'spec/models/tag_spec.rb')
-rw-r--r-- | spec/models/tag_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb index 360bbc16d..7a5b8ec89 100644 --- a/spec/models/tag_spec.rb +++ b/spec/models/tag_spec.rb @@ -12,4 +12,15 @@ RSpec.describe Tag, type: :model do expect(subject.match('https://en.wikipedia.org/wiki/Ghostbusters_(song)#Lawsuit')).to be_nil end end + + describe '.search_for' do + it 'finds tag records with matching names' do + tag = Fabricate(:tag, name: "match") + _miss_tag = Fabricate(:tag, name: "miss") + + results = Tag.search_for("match") + + expect(results).to eq [tag] + end + end end |