Commit fe8fe1140fc7cee31abbfe359542b7de92f1f085

Authored by Braulio Bhavamitra
1 parent 274d9644

rails4,api: fix requires

test/unit/api/api_test.rb
1 -require File.dirname(__FILE__) + '/test_helper' 1 +require_relative 'test_helper'
2 2
3 class MyPlugin < Noosfero::Plugin;end 3 class MyPlugin < Noosfero::Plugin;end
4 class MyPlugin::API;end 4 class MyPlugin::API;end
test/unit/api/articles_test.rb
1 -require File.dirname(__FILE__) + '/test_helper' 1 +require_relative 'test_helper'
2 2
3 class ArticlesTest < ActiveSupport::TestCase 3 class ArticlesTest < ActiveSupport::TestCase
4 4
test/unit/api/categories_test.rb
1 -require File.dirname(__FILE__) + '/test_helper' 1 +require_relative 'test_helper'
2 2
3 class CategoriesTest < ActiveSupport::TestCase 3 class CategoriesTest < ActiveSupport::TestCase
4 4
test/unit/api/comments_test.rb
1 -require File.dirname(__FILE__) + '/test_helper' 1 +require_relative 'test_helper'
2 2
3 class CommentsTest < ActiveSupport::TestCase 3 class CommentsTest < ActiveSupport::TestCase
4 4
test/unit/api/communities_test.rb
1 -require File.dirname(__FILE__) + '/test_helper' 1 +require_relative 'test_helper'
2 2
3 class CommunitiesTest < ActiveSupport::TestCase 3 class CommunitiesTest < ActiveSupport::TestCase
4 4
test/unit/api/enterprises_test.rb
1 -require File.dirname(__FILE__) + '/test_helper' 1 +require_relative 'test_helper'
2 2
3 class EnterprisesTest < ActiveSupport::TestCase 3 class EnterprisesTest < ActiveSupport::TestCase
4 4
test/unit/api/helpers_test.rb
1 -require File.dirname(__FILE__) + '/test_helper'  
2 -require File.expand_path(File.dirname(__FILE__) + "/../../../lib/noosfero/api/helpers") 1 +require_relative 'test_helper'
  2 +require 'noosfero/api/helpers'
3 3
4 class APIHelpersTest < ActiveSupport::TestCase 4 class APIHelpersTest < ActiveSupport::TestCase
5 5
@@ -54,35 +54,35 @@ class APIHelpersTest &lt; ActiveSupport::TestCase @@ -54,35 +54,35 @@ class APIHelpersTest &lt; ActiveSupport::TestCase
54 should 'limit be defined as the params limit value' do 54 should 'limit be defined as the params limit value' do
55 local_limit = 30 55 local_limit = 30
56 self.params= {:limit => local_limit} 56 self.params= {:limit => local_limit}
57 - assert_equal local_limit, limit 57 + assert_equal local_limit, limit
58 end 58 end
59 59
60 should 'return default limit if the limit parameter is minor than zero' do 60 should 'return default limit if the limit parameter is minor than zero' do
61 self.params= {:limit => -1} 61 self.params= {:limit => -1}
62 - assert_equal 20, limit 62 + assert_equal 20, limit
63 end 63 end
64 64
65 should 'the default limit be 20' do 65 should 'the default limit be 20' do
66 - assert_equal 20, limit 66 + assert_equal 20, limit
67 end 67 end
68 68
69 should 'the beginning of the period be the first existent date if no from date is passsed as parameter' do 69 should 'the beginning of the period be the first existent date if no from date is passsed as parameter' do
70 assert_equal Time.at(0).to_datetime, period(nil, nil).to_a[0] 70 assert_equal Time.at(0).to_datetime, period(nil, nil).to_a[0]
71 - end 71 + end
72 72
73 should 'the beginning of the period be from date passsed as parameter' do 73 should 'the beginning of the period be from date passsed as parameter' do
74 from = DateTime.now 74 from = DateTime.now
75 assert_equal from, period(from, nil).min 75 assert_equal from, period(from, nil).min
76 - end 76 + end
77 77
78 should 'the end of the period be now if no until date is passsed as parameter' do 78 should 'the end of the period be now if no until date is passsed as parameter' do
79 assert_in_delta DateTime.now, period(nil, nil).max 79 assert_in_delta DateTime.now, period(nil, nil).max
80 - end 80 + end
81 81
82 should 'the end of the period be until date passsed as parameter' do 82 should 'the end of the period be until date passsed as parameter' do
83 until_date = DateTime.now 83 until_date = DateTime.now
84 assert_equal until_date, period(nil, until_date).max 84 assert_equal until_date, period(nil, until_date).max
85 - end 85 + end
86 86
87 should 'parse_content_type return nil if its blank' do 87 should 'parse_content_type return nil if its blank' do
88 assert_nil parse_content_type("") 88 assert_nil parse_content_type("")
@@ -96,23 +96,23 @@ class APIHelpersTest &lt; ActiveSupport::TestCase @@ -96,23 +96,23 @@ class APIHelpersTest &lt; ActiveSupport::TestCase
96 assert_equivalent ['TextArticle','TinyMceArticle'], parse_content_type("TextArticle,TinyMceArticle") 96 assert_equivalent ['TextArticle','TinyMceArticle'], parse_content_type("TextArticle,TinyMceArticle")
97 end 97 end
98 98
99 - should 'find_article return article by id in list passed for user with permission' do 99 + should 'find_article return article by id in list passed for user with permission' do
100 user = create_user('someuser') 100 user = create_user('someuser')
101 a = fast_create(Article, :profile_id => user.person.id) 101 a = fast_create(Article, :profile_id => user.person.id)
102 fast_create(Article, :profile_id => user.person.id) 102 fast_create(Article, :profile_id => user.person.id)
103 fast_create(Article, :profile_id => user.person.id) 103 fast_create(Article, :profile_id => user.person.id)
104 - 104 +
105 user.generate_private_token! 105 user.generate_private_token!
106 User.expects(:find_by_private_token).returns(user) 106 User.expects(:find_by_private_token).returns(user)
107 assert_equal a, find_article(user.person.articles, a.id) 107 assert_equal a, find_article(user.person.articles, a.id)
108 end 108 end
109 109
110 - should 'find_article return forbidden when a user try to access an article without permission' do 110 + should 'find_article return forbidden when a user try to access an article without permission' do
111 user = create_user('someuser') 111 user = create_user('someuser')
112 p = fast_create(Profile) 112 p = fast_create(Profile)
113 a = fast_create(Article, :published => false, :profile_id => p.id) 113 a = fast_create(Article, :published => false, :profile_id => p.id)
114 fast_create(Article, :profile_id => p.id) 114 fast_create(Article, :profile_id => p.id)
115 - 115 +
116 user.generate_private_token! 116 user.generate_private_token!
117 User.expects(:find_by_private_token).returns(user) 117 User.expects(:find_by_private_token).returns(user)
118 assert_equal 403, find_article(p.articles, a.id).last 118 assert_equal 403, find_article(p.articles, a.id).last
test/unit/api/people_test.rb
1 -require File.dirname(__FILE__) + '/test_helper' 1 +require_relative 'test_helper'
2 2
3 class PeopleTest < ActiveSupport::TestCase 3 class PeopleTest < ActiveSupport::TestCase
4 4
test/unit/api/session_test.rb
1 -require File.dirname(__FILE__) + '/test_helper' 1 +require_relative 'test_helper'
2 2
3 class SessionTest < ActiveSupport::TestCase 3 class SessionTest < ActiveSupport::TestCase
4 4
test/unit/api/task_test.rb
1 -require File.dirname(__FILE__) + '/test_helper' 1 +require_relative 'test_helper'
2 2
3 class TasksTest < ActiveSupport::TestCase 3 class TasksTest < ActiveSupport::TestCase
4 4
test/unit/api/test_helper.rb
1 -require File.dirname(__FILE__) + '/../../test_helper' 1 +require 'test_helper'
2 2
3 class ActiveSupport::TestCase 3 class ActiveSupport::TestCase
4 4