mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 17:15:32 +08:00
b9a310f4b1
than passing params everywhere. Also make the private API private.
28 lines
667 B
Ruby
28 lines
667 B
Ruby
require 'spec_helper'
|
|
|
|
describe SearchController do
|
|
|
|
it 'performs the query' do
|
|
guardian = Guardian.new
|
|
Guardian.stubs(:new).returns(guardian)
|
|
|
|
search = mock()
|
|
Search.expects(:new).with('test', guardian: guardian, type_filter: nil).returns(search)
|
|
search.expects(:execute)
|
|
|
|
xhr :get, :query, term: 'test'
|
|
end
|
|
|
|
it 'performs the query with a filter' do
|
|
guardian = Guardian.new
|
|
Guardian.stubs(:new).returns(guardian)
|
|
|
|
search = mock()
|
|
Search.expects(:new).with('test', guardian: guardian, type_filter: 'topic').returns(search)
|
|
search.expects(:execute)
|
|
|
|
xhr :get, :query, term: 'test', type_filter: 'topic'
|
|
end
|
|
|
|
end
|