diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2012-05-02 13:36:15 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2012-05-02 13:36:15 +0100 |
commit | ce00cd469a983d32f9f84602c971618baa63444c (patch) | |
tree | 592d0b62433cd1f5cd29446419e16ec00c82b88f | |
parent | 0aad693a43ee709487d80b8049672bf4b74ddddf (diff) |
Make the order of words in a track_thing description deterministic, so the test always passes
-rw-r--r-- | app/models/track_thing.rb | 1 | ||||
-rw-r--r-- | spec/models/track_thing_spec.rb | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb index 58d70ed86..02b5c9234 100644 --- a/app/models/track_thing.rb +++ b/app/models/track_thing.rb @@ -116,6 +116,7 @@ class TrackThing < ActiveRecord::Base end descriptions += Array(varieties) parsed_text = parsed_text.strip + descriptions.sort! descriptions = descriptions.join(_(" or ")) if !parsed_text.empty? descriptions += _("{{list_of_things}} matching text '{{search_query}}'", :list_of_things => "", :search_query => parsed_text) diff --git a/spec/models/track_thing_spec.rb b/spec/models/track_thing_spec.rb index bd122941a..93f407475 100644 --- a/spec/models/track_thing_spec.rb +++ b/spec/models/track_thing_spec.rb @@ -36,7 +36,7 @@ describe TrackThing, "when tracking changes" do it "will make some sane descriptions of search-based tracks" do tests = [['bob variety:user', "users matching text 'bob'"], - ['bob (variety:sent OR variety:followup_sent OR variety:response OR variety:comment) (latest_status:successful OR latest_status:partially_successful OR latest_status:rejected OR latest_status:not_held)', "requests which are successful or unsuccessful or comments matching text 'bob'"], + ['bob (variety:sent OR variety:followup_sent OR variety:response OR variety:comment) (latest_status:successful OR latest_status:partially_successful OR latest_status:rejected OR latest_status:not_held)', "comments or requests which are successful or unsuccessful matching text 'bob'"], ['(latest_status:waiting_response OR latest_status:waiting_clarification OR waiting_classification:true)', 'requests which are awaiting a response']] for query, description in tests track_thing = TrackThing.create_track_for_search_query(query) |