test/unit/model_gateway_test.rb in elasticsearch-persistence-0.1.8 vs test/unit/model_gateway_test.rb in elasticsearch-persistence-0.1.9
- old
+ new
@@ -87,13 +87,15 @@
should "set @persisted variable from hash when deserializing" do
assert DummyGatewayModel.gateway.deserialize('_id' => 'abc123', '_source' => {}).instance_variable_get(:@persisted)
end
+ should "allow accessing the raw _source" do
+ assert_equal 'bar', DummyGatewayModel.gateway.deserialize('_source' => { 'foo' => 'bar' })._source['foo']
+ end
+
should "allow to access the raw hit from results as Hashie::Mash" do
assert_equal 0.42, DummyGatewayModel.gateway.deserialize('_score' => 0.42, '_source' => {}).hit._score
end
-
-
end
end