Skip to content

Instantly share code, notes, and snippets.

@freegenie
Created April 25, 2011 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freegenie/940335 to your computer and use it in GitHub Desktop.
Save freegenie/940335 to your computer and use it in GitHub Desktop.
search_spec.rb
require 'spec_helper'
describe Network::SearchController do
before do
request.env['HTTPS'] = 'on'
end
describe '#global' do
context 'anonymously' do
before do
end
it 'should find in searchable projects' do
results = mock_search_results_for([])
Project.should_receive(:search) do |term, options|
options[:with][:searchable].should == true
results
end
Asset.stubs(:search => results)
User.stubs(:search => results)
get :global, {:q => 'search'}
end
it 'should find public and restricted projects' do
results = mock_search_results_for([])
Project.should_receive(:search) do |term, options|
options[:with][:kind].should == [0,1]
results
end
Asset.stubs(:search => results)
User.stubs(:search => results)
get :global, {:q => 'search'}
end
it 'should find in searchable assets' do
pending
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment