spec/search_kit/models/document_spec.rb in search-kit-0.0.7 vs spec/search_kit/models/document_spec.rb in search-kit-0.0.8
- old
+ new
@@ -15,20 +15,30 @@
subject { document.get(key) }
context 'when the source has the available content' do
let(:content) { :key_content }
- let(:document_data) { { attributes: { key => content } } }
+ let(:document_data) { { source: { key => content } } }
it "returns the content" do
expect(subject).to eq content
end
+
+ context 'method missing coverage' do
+ it { expect(document).to respond_to :a_key }
+ it { expect(document.a_key).to eq content }
+ end
end
context 'otherwise' do
it "raises an attribute not found error" do
expect { subject }
.to raise_exception(described_class::AttributeNotFound)
+ end
+
+ context 'method missing coverage' do
+ it { expect(document).not_to respond_to :a_key }
+ it { expect { document.a_key }.to raise_exception(NoMethodError) }
end
end
end
end