Commit e8b5d816 authored by James Lopez's avatar James Lopez

fix spec and added options to Issue

parent 181fd9b1
...@@ -30,6 +30,8 @@ class Issue < ActiveRecord::Base ...@@ -30,6 +30,8 @@ class Issue < ActiveRecord::Base
include Elastic::IssuesSearch include Elastic::IssuesSearch
WEIGHT_RANGE = 1..9 WEIGHT_RANGE = 1..9
WEIGHT_ANY = 'Any Weight'
WEIGHT_NONE = 'No Weight'
ActsAsTaggableOn.strict_case_match = true ActsAsTaggableOn.strict_case_match = true
...@@ -123,4 +125,8 @@ class Issue < ActiveRecord::Base ...@@ -123,4 +125,8 @@ class Issue < ActiveRecord::Base
note.all_references(current_user).merge_requests note.all_references(current_user).merge_requests
end.uniq.select { |mr| mr.open? && mr.closes_issue?(self) } end.uniq.select { |mr| mr.open? && mr.closes_issue?(self) }
end end
def self.weight_options
[WEIGHT_ANY, WEIGHT_NONE] + WEIGHT_RANGE.to_a
end
end end
...@@ -43,6 +43,6 @@ feature 'Issue filtering by Weight', feature: true do ...@@ -43,6 +43,6 @@ feature 'Issue filtering by Weight', feature: true do
end end
def random_weight def random_weight
Issue::WEIGHT_RANGE.sample Issue::WEIGHT_RANGE.to_a.sample
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment