Commit 51dfc2df0e92a326d416ac9b9cda039b7c32a654

Authored by Rafael Martins
1 parent 65d9ab1c

A few test fixes for dealing with the new search results

test/functional/profile_search_controller_test.rb
@@ -51,7 +51,7 @@ class ProfileSearchControllerTest < ActionController::TestCase @@ -51,7 +51,7 @@ class ProfileSearchControllerTest < ActionController::TestCase
51 51
52 get 'index', :profile => person.identifier, :q => 'Article' 52 get 'index', :profile => person.identifier, :q => 'Article'
53 53
54 - assert_equal 10, assigns(:results).size 54 + assert_equal 10, assigns('results').docs.size
55 assert_tag :tag => 'a', :attributes => { :href => "/profile/#{person.identifier}/search?page=2&q=Article", :rel => 'next' } 55 assert_tag :tag => 'a', :attributes => { :href => "/profile/#{person.identifier}/search?page=2&q=Article", :rel => 'next' }
56 end 56 end
57 57
test/unit/article_test.rb
@@ -1512,7 +1512,7 @@ class ArticleTest < ActiveSupport::TestCase @@ -1512,7 +1512,7 @@ class ArticleTest < ActiveSupport::TestCase
1512 should 'index by schema name when database is postgresql' do 1512 should 'index by schema name when database is postgresql' do
1513 uses_postgresql 'schema_one' 1513 uses_postgresql 'schema_one'
1514 art1 = Article.create!(:name => 'some thing', :profile_id => @profile.id) 1514 art1 = Article.create!(:name => 'some thing', :profile_id => @profile.id)
1515 - assert_equal [art1], Article.find_by_contents('thing')[:results] 1515 + assert_equal [art1], Article.find_by_contents('thing')[:results].docs
1516 uses_postgresql 'schema_two' 1516 uses_postgresql 'schema_two'
1517 art2 = Article.create!(:name => 'another thing', :profile_id => @profile.id) 1517 art2 = Article.create!(:name => 'another thing', :profile_id => @profile.id)
1518 assert_not_includes Article.find_by_contents('thing')[:results], art1 1518 assert_not_includes Article.find_by_contents('thing')[:results], art1
@@ -1526,7 +1526,7 @@ class ArticleTest < ActiveSupport::TestCase @@ -1526,7 +1526,7 @@ class ArticleTest < ActiveSupport::TestCase
1526 should 'not index by schema name when database is not postgresql' do 1526 should 'not index by schema name when database is not postgresql' do
1527 uses_sqlite 1527 uses_sqlite
1528 art1 = Article.create!(:name => 'some thing', :profile_id => @profile.id) 1528 art1 = Article.create!(:name => 'some thing', :profile_id => @profile.id)
1529 - assert_equal Article.find_by_contents('thing')[:results], [art1] 1529 + assert_equal [art1], Article.find_by_contents('thing')[:results].docs
1530 art2 = Article.create!(:name => 'another thing', :profile_id => @profile.id) 1530 art2 = Article.create!(:name => 'another thing', :profile_id => @profile.id)
1531 assert_includes Article.find_by_contents('thing')[:results], art1 1531 assert_includes Article.find_by_contents('thing')[:results], art1
1532 assert_includes Article.find_by_contents('thing')[:results], art2 1532 assert_includes Article.find_by_contents('thing')[:results], art2
test/unit/text_article_test.rb
@@ -17,7 +17,7 @@ class TextArticleTest < ActiveSupport::TestCase @@ -17,7 +17,7 @@ class TextArticleTest < ActiveSupport::TestCase
17 should 'found TextileArticle by TextArticle indexes' do 17 should 'found TextileArticle by TextArticle indexes' do
18 person = create_user('testuser').person 18 person = create_user('testuser').person
19 article = TextileArticle.create!(:name => 'found article test', :profile => person) 19 article = TextileArticle.create!(:name => 'found article test', :profile => person)
20 - assert_equal TextileArticle.find_by_contents('found'), TextArticle.find_by_contents('found') 20 + assert_equal TextileArticle.find_by_contents('found')[:results].docs, TextArticle.find_by_contents('found')[:results].docs
21 end 21 end
22 22
23 should 'remove HTML from name' do 23 should 'remove HTML from name' do