Commit 5e2542c4ceb4e09b0cc11f8301c128a0fc1f4aae

Authored by Leandro Santos
1 parent 4cf48c98

fixing unit tests

lib/noosfero/api/helpers.rb
... ... @@ -94,6 +94,7 @@
94 94 if params[:categories_ids]
95 95 articles = articles.joins(:categories).where('category_id in (?)', params[:categories_ids])
96 96 end
  97 + articles
97 98 end
98 99  
99 100 def find_task(asset, id)
... ...
test/unit/api/articles_test.rb
... ... @@ -3,6 +3,7 @@ require File.dirname(__FILE__) + '/test_helper'
3 3 class ArticlesTest < ActiveSupport::TestCase
4 4  
5 5 def setup
  6 + Environment.destroy_all
6 7 login_api
7 8 end
8 9  
... ...
test/unit/api/test_helper.rb
... ... @@ -9,7 +9,8 @@ class ActiveSupport::TestCase
9 9 end
10 10  
11 11 def login_api
12   - @user = User.create!(:login => 'testapi', :password => 'testapi', :password_confirmation => 'testapi', :email => 'test@test.org', :environment => Environment.default)
  12 + @environment = fast_create(Environment, :is_default => true)
  13 + @user = User.create!(:login => 'testapi', :password => 'testapi', :password_confirmation => 'testapi', :email => 'test@test.org', :environment => @environment)
13 14 @user.activate
14 15 @person = @user.person
15 16  
... ... @@ -18,7 +19,7 @@ class ActiveSupport::TestCase
18 19 @private_token = json["private_token"]
19 20 @params = {:private_token => @private_token}
20 21 end
21   - attr_accessor :private_token, :user, :person, :params
  22 + attr_accessor :private_token, :user, :person, :params, :environment
22 23  
23 24 private
24 25  
... ...