spec/search_kit/cli/indices_spec.rb in search-kit-0.0.6 vs spec/search_kit/cli/indices_spec.rb in search-kit-0.0.7
- old
+ new
@@ -102,69 +102,9 @@
end
end
end
end
- describe '#scaffold' do
- let(:documents) { [{ title: "Yep", id: 1 }] }
- let(:documents_json) { documents.to_json }
- let(:name) { "Index Name" }
-
- before { allow(cli.client).to receive(:scaffold).and_return(response) }
-
- subject { cli.scaffold(name, documents_json) }
-
- it "calls client.create with the index name" do
- expect(cli.client).to receive(:scaffold).with(name, documents)
- subject
- end
-
- it "reports on its results" do
- expect(cli.messages).to receive(:info).with(an_instance_of(String))
- subject
- end
-
- context 'error handling' do
- before { allow(cli.client).to receive(:scaffold).and_raise(*error) }
-
- context 'unauthorized error' do
- let(:error) { SearchKit::Errors::Unauthorized }
-
- it do
- expect(cli.messages).to receive(:unauthorized)
- subject
- end
- end
-
- context 'unprocessable error' do
- let(:error) { SearchKit::Errors::Unprocessable }
-
- it do
- expect(cli.messages).to receive(:unprocessable)
- subject
- end
- end
-
- context 'json error' do
- let(:error) { JSON::ParserError }
-
- it do
- expect(cli.messages).to receive(:json_parse_error)
- subject
- end
- end
-
- context 'no service error' do
- let(:error) { [Faraday::ConnectionFailed, "Message"] }
-
- it do
- expect(cli.messages).to receive(:no_service)
- subject
- end
- end
- end
- end
-
describe '#show' do
before { allow(cli.client).to receive(:show).and_return(response) }
subject { cli.show(slug) }