Commit 3fc5784bf2193ad81ccc068014461dbbfc550379

Authored by Daniela Feitosa
Committed by Rafael Martins
1 parent 511a0c1b

Fixed unit and functionals

app/models/article.rb
... ... @@ -114,6 +114,7 @@ class Article < ActiveRecord::Base
114 114 ids.uniq.each do |item|
115 115 add_category(Category.find(item)) unless item.to_i.zero?
116 116 end
  117 + self.categories(true)
117 118 end
118 119  
119 120 after_create :create_pending_categorizations
... ...
test/functional/enterprise_registration_controller_test.rb
... ... @@ -52,7 +52,7 @@ all_fixtures
52 52 env = Environment.default
53 53 env.organization_approval_method = :none
54 54 env.save
55   - region = fast_create(Region)
  55 + region = fast_create(Region, {}, :search => true)
56 56  
57 57 data = { :name => 'My new enterprise', :identifier => 'mynew', :region => region }
58 58 create_enterprise = CreateEnterprise.new(data)
... ...
test/unit/article_test.rb
... ... @@ -1562,10 +1562,10 @@ class ArticleTest < ActiveSupport::TestCase
1562 1562 end
1563 1563  
1564 1564 should 'survive to a invalid src attribute while looking for images in body' do
1565   - domain = Environment.default.domains.first.name
  1565 + domain = Environment.default.domains.first || Domain.new(:name => 'localhost')
1566 1566 article = Article.new(:body => "An article with invalid src in img tag <img src='path with spaces.png' />", :profile => @profile)
1567 1567 assert_nothing_raised URI::InvalidURIError do
1568   - assert_equal ["http://#{domain}/path%20with%20spaces.png"], article.body_images_paths
  1568 + assert_equal ["http://#{domain.name}/path%20with%20spaces.png"], article.body_images_paths
1569 1569 end
1570 1570 end
1571 1571  
... ...