Commit 7d9e8a843952c6c6cef86efb8fade2c83e25cc66

Authored by Rafael Martins
1 parent c428aac0

Added functional test for ProfileSearchController

test/functional/profile_search_controller_test.rb
... ... @@ -33,6 +33,15 @@ class ProfileSearchControllerTest < ActionController::TestCase
33 33 assert_includes assigns(:results), article
34 34 end
35 35  
  36 + should 'not display articles from another profile' do
  37 + article = TextileArticle.create(:name => 'My article', :body => 'Article to test profile search', :profile => person)
  38 + article2 = TextileArticle.create(:name => 'Another article', :body => 'Article from someone else', :profile => fast_create(Person))
  39 +
  40 + get 'index', :profile => person.identifier, :q => 'article'
  41 + assert_includes assigns(:results), article
  42 + assert_not_includes assigns(:results), article2
  43 + end
  44 +
36 45 should 'display search results' do
37 46 article1 = fast_create(Article, {:body => '<p>Article to test profile search</p>', :profile_id => person.id}, :search => true)
38 47 article2 = fast_create(Article, {:body => '<p>Another article to test profile search</p>', :profile_id => person.id}, :search => true)
... ...