fix issue locomotivecms/engine#1093

did committed Dec 09, 2015
commit 2e1b6b821d8e0008dd6b9f616e153b9e9b1e980a
Showing 3 changed files with 11 additions and 2 deletions
locomotive/steam/adapters/memory/condition.rb b/lib/locomotive/steam/adapters/memory/condition.rb +1 -1
@@ @@ -41,7 +41,7 @@ module Locomotive::Steam
end
def inspect
- "#{field}#{operator != :== ? '.' : ' '}#{operator} #{value}"
+ "#{field}#{operator != :== ? '.' : ' '}#{operator} #{value.inspect}"
end
protected
locomotive/steam/repositories/content_entry_repository.rb b/lib/locomotive/steam/repositories/content_entry_repository.rb +3 -1
@@ @@ -217,7 +217,9 @@ module Locomotive
operator = @operators[name]
_name = operator ? "#{name}.#{operator}" : name
- if value = @conditions[_name]
+ if @conditions.has_key?(_name)
+ value = @conditions[_name]
+
# delete old name
@conditions.delete(_name)
spec/unit/repositories/content_entry_repository_spec.rb +7 -0
@@ @@ -380,6 +380,13 @@ describe Locomotive::Steam::ContentEntryRepository do
end
+ context 'testing a nil value (field.ne => nil)' do
+
+ let(:conditions) { { 'person.ne' => nil } }
+ it { is_expected.to eq([{ _visible: true, content_type_id: 1, 'person_id.ne' => nil }, nil]) }
+
+ end
+
end
context 'many_to_many fields' do