如何在测试中为模型建立索引?我用耐嚼的宝石

时间:2018-11-23 17:57:48

标签: ruby-on-rails elasticsearch rspec rspec-rails chewy-gem

我将chewy用于ES,并将VCR用于查询。

例如。

这不是搜索查询。

it 'when a user' do
  VCR.use_cassette('elasticsearch_query') do
    search = Search.new(params: params, current_user: user, current_team: team)
    expect(search.current_user).to eq(user)
  end
end

vcr文件,我看到以下响应。 为什么?

string: '{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no
-        such index","resource.type":"index_or_alias","resource.id":"test_leads","index_uuid":"_na_","index":"test_leads"}],"type":"index_not_found_exception","reason":"no
-        such index","resource.type":"index_or_alias","resource.id":"test_leads","index_uuid":"_na_","index":"test_leads"},"status":404}'`

0 个答案:

没有答案