Skip to content
This repository has been archived by the owner on Nov 7, 2018. It is now read-only.

Commit

Permalink
test to check contents of nested docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarah Allen committed Mar 1, 2016
1 parent 70442ca commit 153bbb6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/lib/data_magic/import_with_nested_files_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,25 @@
let(:sort) { nil }
let(:result) { DataMagic.search(query, sort: sort) }
let(:first) { result['results'].first }
let(:id_one) { result['results'].find { |item| item['id'] == '1' } }
let(:total) { result['metadata']['total'] }

it "creates one document per unique id" do
expect(total).to eq(11)
end

it "nests documents per unique id" do
expect(id_one['id']).to eq('1')
expect(id_one['2013']).to_not be_nil
end

it "root document contains special 'only' fields" do
expect(id_one['id']).to eq('1')
expect(id_one['name']).to eq('Reichert University')
expect(id_one['city']).to eq('Normal')
expect(id_one['state']).to eq('AL')
end

context "can import a subset of fields" do
context "and when searching for a field value" do
let(:query) { {zipcode: "35762"} }
Expand Down

0 comments on commit 153bbb6

Please sign in to comment.