diff options
Diffstat (limited to 'test/models/event_test.rb')
| -rw-r--r-- | test/models/event_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/models/event_test.rb b/test/models/event_test.rb index a5449a2a..49af8e38 100644 --- a/test/models/event_test.rb +++ b/test/models/event_test.rb | |||
| @@ -178,4 +178,29 @@ class EventTest < ActiveSupport::TestCase | |||
| 178 | assert event.save | 178 | assert event.save |
| 179 | assert_equal event.start_time, event.occurrences.first&.start_time | 179 | assert_equal event.start_time, event.occurrences.first&.start_time |
| 180 | end | 180 | end |
| 181 | |||
| 182 | test "editor_search matches across columns" do | ||
| 183 | match = Event.create!(:title => "Chaosradio Spezial", :location => "Zentrale") | ||
| 184 | other = Event.create!(:title => "Nothing distinctive") | ||
| 185 | |||
| 186 | assert_includes Event.editor_search("chaosradio"), match | ||
| 187 | assert_not_includes Event.editor_search("chaosradio"), other | ||
| 188 | assert_includes Event.editor_search("zentrale"), match, | ||
| 189 | "location should be searchable" | ||
| 190 | end | ||
| 191 | |||
| 192 | test "editor_search ANDs multiple words" do | ||
| 193 | Event.create!(:title => "Chaosradio Spezial") | ||
| 194 | |||
| 195 | assert_not_empty Event.editor_search("chaosradio spezial") | ||
| 196 | assert_empty Event.editor_search("chaosradio zzzznomatch") | ||
| 197 | end | ||
| 198 | |||
| 199 | test "editor_search finds an event by its tag" do | ||
| 200 | event = Event.create!(:title => "Nothing distinctive") | ||
| 201 | event.tag_list.add("open-day") | ||
| 202 | event.save! | ||
| 203 | |||
| 204 | assert_includes Event.editor_search("open-day"), event | ||
| 205 | end | ||
| 181 | end | 206 | end |
