discourse/spec/controllers/search_controller_spec.rb
Robin Ward b9a310f4b1 Search Refactor: Let's use a class to keep track of our state rather
than passing params everywhere. Also make the private API private.
2013-05-22 15:22:06 -04:00

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