Skip to content

Commit

Permalink
Merge d8977ef into 8f650d8
Browse files Browse the repository at this point in the history
  • Loading branch information
senid231 committed Jul 1, 2016
2 parents 8f650d8 + d8977ef commit 57468ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/active_admin/filters/humanized.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def parse_parameter_body
end

def current_predicate
@current_predicate ||= predicates.detect { |p| @body.include?(p) }
@current_predicate ||= predicates.detect { |p| @body.end_with?("_#{p}") }
end

def predicates
Expand Down
8 changes: 8 additions & 0 deletions spec/unit/filters/humanized_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,13 @@
expect(humanizer.body).to eq("Name Predicate Does Not Exist")
end
end

context 'when column name similar to predicate' do
it 'parses correct predicate' do
param = ['time_start_gteq', 'test']
humanizer = ActiveAdmin::Filters::Humanized.new(param)
expect(humanizer.body).to eq('Time Start greater than or equal to')
end
end
end
end

0 comments on commit 57468ef

Please sign in to comment.