test/document_test.rb in inquisitio-0.1.5 vs test/document_test.rb in inquisitio-0.1.6

- old
+ new

@@ -42,7 +42,27 @@ def test_create_valid_SDF_json assert_equal JSON.parse(@expected_SDF).to_json, JSON.parse(@document.to_SDF).to_json end + + def test_should_ignore_null_field_values_when_creating_SDF_json + expected_SDF = + <<-EOS +{ "type": "add", + "id": "12345", + "version": 1, + "lang": "en", + "fields": { + "title": "The Title" + } +} + EOS + + fields = { :title => 'The Title', :author => nil } + document = Document.new(@type, @id, @version, fields) + + assert_equal JSON.parse(expected_SDF).to_json, + JSON.parse(document.to_SDF).to_json + end end end