Commit c3d44d0ab674727c162f42f9dc257efad5420bf9
1 parent
b5cd5178
Exists in
master
and in
29 other branches
Fixes on ArticleTest
* Use correct 'domain' from environment * Use find to get article
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
test/unit/article_test.rb
... | ... | @@ -756,6 +756,9 @@ class ArticleTest < ActiveSupport::TestCase |
756 | 756 | a.category_ids = ['0', c.id, nil] |
757 | 757 | assert a.save |
758 | 758 | assert_equal [c], a.categories |
759 | + | |
760 | + a = profile.articles.find_by_name 'a test article' | |
761 | + assert_equal [c], a.categories | |
759 | 762 | end |
760 | 763 | |
761 | 764 | should 'add owner on cache_key when has profile' do |
... | ... | @@ -1509,7 +1512,7 @@ class ArticleTest < ActiveSupport::TestCase |
1509 | 1512 | should 'index by schema name when database is postgresql' do |
1510 | 1513 | uses_postgresql 'schema_one' |
1511 | 1514 | art1 = Article.create!(:name => 'some thing', :profile_id => @profile.id) |
1512 | - assert_equal Article.find_by_contents('thing')[:results], [art1] | |
1515 | + assert_equal [art1], Article.find_by_contents('thing')[:results] | |
1513 | 1516 | uses_postgresql 'schema_two' |
1514 | 1517 | art2 = Article.create!(:name => 'another thing', :profile_id => @profile.id) |
1515 | 1518 | assert_not_includes Article.find_by_contents('thing')[:results], art1 |
... | ... | @@ -1559,9 +1562,10 @@ class ArticleTest < ActiveSupport::TestCase |
1559 | 1562 | end |
1560 | 1563 | |
1561 | 1564 | should 'survive to a invalid src attribute while looking for images in body' do |
1565 | + domain = Environment.default.domains.first.name | |
1562 | 1566 | article = Article.new(:body => "An article with invalid src in img tag <img src='path with spaces.png' />", :profile => @profile) |
1563 | 1567 | assert_nothing_raised URI::InvalidURIError do |
1564 | - assert_equal ['http://localhost/path%20with%20spaces.png'], article.body_images_paths | |
1568 | + assert_equal ["http://#{domain}/path%20with%20spaces.png"], article.body_images_paths | |
1565 | 1569 | end |
1566 | 1570 | end |
1567 | 1571 | ... | ... |