mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
FEATURE: increase search expansion to 50 results
refactor search code to deal with proper objects use proper serializers, test the controllers
This commit is contained in:
@ -2,6 +2,25 @@ require 'spec_helper'
|
||||
|
||||
describe SearchController do
|
||||
|
||||
context "integration" do
|
||||
|
||||
before do
|
||||
ActiveRecord::Base.observers.enable :search_observer
|
||||
end
|
||||
|
||||
it "can search correctly" do
|
||||
my_post = Fabricate(:post, raw: 'this is my really awesome post')
|
||||
xhr :get, :query, term: 'awesome', include_blurb: true
|
||||
|
||||
response.should be_success
|
||||
data = JSON.parse(response.body)
|
||||
data['posts'][0]['id'].should == my_post.id
|
||||
data['posts'][0]['blurb'].should == 'this is my really awesome post'
|
||||
data['topics'][0]['id'].should == my_post.topic_id
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
let(:search_context) { {type: 'user', id: 'eviltrout'} }
|
||||
|
||||
context "basics" do
|
||||
|
Reference in New Issue
Block a user