Commit 5364d94301beea4919d977dc566a475a9811ca54

Authored by Cyril Mougel
1 parent 91f734da
Exists in master and in 1 other branch production

The search need search on where field too

This search was revert in commit
[039744a1bb25e6b9ed1bd287554f039ebdc2df60]
app/models/problem.rb
... ... @@ -153,7 +153,13 @@ class Problem
153 153 end
154 154  
155 155 def self.search(value)
156   - any_of({:error_class => /#{value}/i}, {:message => /#{value}/i}, {:app_name => /#{value}/i}, {:environment => /#{value}/i})
  156 + any_of(
  157 + {:error_class => /#{value}/i},
  158 + {:where => /#{value}/i},
  159 + {:message => /#{value}/i},
  160 + {:app_name => /#{value}/i},
  161 + {:environment => /#{value}/i}
  162 + )
157 163 end
158 164  
159 165 private
... ...
spec/models/problem_spec.rb
1 1 require 'spec_helper'
2 2  
3 3 describe Problem do
4   -
  4 +
5 5 context 'validations' do
6 6 it 'requires a error_class' do
7 7 err = Fabricate.build(:problem, :error_class => nil)
... ... @@ -15,7 +15,7 @@ describe Problem do
15 15 err.errors[:environment].should include("can't be blank")
16 16 end
17 17 end
18   -
  18 +
19 19 describe "Fabrication" do
20 20 context "Fabricate(:problem)" do
21 21 it 'should have no comment' do
... ... @@ -195,6 +195,10 @@ describe Problem do
195 195 Problem.search("theErrorClass").unresolved.should include(find)
196 196 Problem.search("theErrorClass").unresolved.should_not include(dont_find)
197 197 end
  198 + it 'find on where message' do
  199 + problem = Fabricate(:problem, :where => 'cyril')
  200 + Problem.search('cyril').entries.should eq [problem]
  201 + end
198 202 end
199 203 end
200 204  
... ...