ruby 第3步 - 测试ElasticSearch - posts_spec.rb

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby 第3步 - 测试ElasticSearch - posts_spec.rb相关的知识,希望对你有一定的参考价值。

require 'spec_helper'
require 'rake'

RSpec.describe Api::V1::PostsController, :vcr, record: :new_episodes, :type => :api do

  context "elastic search test", elasticsearch: true, commit: true do
    before do
      @post = FactoryGirl.create(:post, first_name: "August", last_name: "Rush", email: "August.Rush@augustrush.com", event: "Rock Concert")
    end
  
    it "should handle case-insensitive searching for a user" do
      sleep 1
      get "1/posts", {:search=>"Rush"}
      expect(last_response.body).to include("August", "Rush")
    end

  end
 
end

以上是关于ruby 第3步 - 测试ElasticSearch - posts_spec.rb的主要内容,如果未能解决你的问题,请参考以下文章