Sha256: 0b51aff00271411173f1c76cb65417ae6a52940da980d376d3f245c73c297f7c
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require 'test_helper' class PartitionedDocumentTest < Test::Unit::TestCase PARTITIONED_DB_PATH = 'http://localhost:5984/partitioned/' test 'unpartitioned DB will raise exception' do stub_request(:get, PARTITIONED_DB_PATH). with(headers: { 'Content-Type'=>'application/json' }). to_return(status: 200, body: { db_name: 'partitioned' }.to_json) assert_raise(Dolly::PartitionedDataBaseExpectedError) do class Partitioned < Dolly::Document partitioned! property :foo, class_name: String end end end test 'document id is partitioned' do stub_request(:get, PARTITIONED_DB_PATH). with(headers: { 'Content-Type'=>'application/json' }). to_return(status: 200, body: { db_name: 'partitioned', props: { partitioned: true } }.to_json) class Partitioned < Dolly::Document set_namespace 'partitioned' partitioned! property :foo, class_name: String end assert_equal Partitioned.absolute_id("partitioned:abc"), "abc" doc = Partitioned.new(foo: "something") assert doc.id =~ /^partitioned:.+/ end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dolly-3.1.5 | test/partitioned_document_test.rb |
dolly-3.1.4 | test/partitioned_document_test.rb |
dolly-3.1.3 | test/partitioned_document_test.rb |