test/indexer_test.rb in inquisitio-0.1.6 vs test/indexer_test.rb in inquisitio-0.1.7
- old
+ new
@@ -5,10 +5,12 @@
def setup
@document_endpoint = 'http://my.document-endpoint.com'
Inquisitio.config.document_endpoint = @document_endpoint
#def initialize(type, id, version, fields)
@documents = [Document.new("add", "12345", 1, {})]
+
+ Inquisitio.config.dry_run = false
end
def teardown
Excon.stubs.clear
end
@@ -67,8 +69,18 @@
Excon.stub({}, {:body => body, :status => 200})
indexer = Indexer.new(@documents)
response = indexer.index
assert_equal body, response
+ end
+
+ def test_index_does_not_post_when_in_dry_run_mode
+ Excon.defaults[:mock] = true
+
+ Inquisitio.config.dry_run = true
+
+ indexer = Indexer.new(@documents)
+ response = indexer.index
+ assert response.nil?
end
end
end