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 3 class MyPlugin < Noosfero::Plugin;end
4 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 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 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 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 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 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 4 class APIHelpersTest < ActiveSupport::TestCase
5 5  
... ... @@ -54,35 +54,35 @@ class APIHelpersTest &lt; ActiveSupport::TestCase
54 54 should 'limit be defined as the params limit value' do
55 55 local_limit = 30
56 56 self.params= {:limit => local_limit}
57   - assert_equal local_limit, limit
  57 + assert_equal local_limit, limit
58 58 end
59 59  
60 60 should 'return default limit if the limit parameter is minor than zero' do
61 61 self.params= {:limit => -1}
62   - assert_equal 20, limit
  62 + assert_equal 20, limit
63 63 end
64 64  
65 65 should 'the default limit be 20' do
66   - assert_equal 20, limit
  66 + assert_equal 20, limit
67 67 end
68 68  
69 69 should 'the beginning of the period be the first existent date if no from date is passsed as parameter' do
70 70 assert_equal Time.at(0).to_datetime, period(nil, nil).to_a[0]
71   - end
  71 + end
72 72  
73 73 should 'the beginning of the period be from date passsed as parameter' do
74 74 from = DateTime.now
75 75 assert_equal from, period(from, nil).min
76   - end
  76 + end
77 77  
78 78 should 'the end of the period be now if no until date is passsed as parameter' do
79 79 assert_in_delta DateTime.now, period(nil, nil).max
80   - end
  80 + end
81 81  
82 82 should 'the end of the period be until date passsed as parameter' do
83 83 until_date = DateTime.now
84 84 assert_equal until_date, period(nil, until_date).max
85   - end
  85 + end
86 86  
87 87 should 'parse_content_type return nil if its blank' do
88 88 assert_nil parse_content_type("")
... ... @@ -96,23 +96,23 @@ class APIHelpersTest &lt; ActiveSupport::TestCase
96 96 assert_equivalent ['TextArticle','TinyMceArticle'], parse_content_type("TextArticle,TinyMceArticle")
97 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 100 user = create_user('someuser')
101 101 a = fast_create(Article, :profile_id => user.person.id)
102 102 fast_create(Article, :profile_id => user.person.id)
103 103 fast_create(Article, :profile_id => user.person.id)
104   -
  104 +
105 105 user.generate_private_token!
106 106 User.expects(:find_by_private_token).returns(user)
107 107 assert_equal a, find_article(user.person.articles, a.id)
108 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 111 user = create_user('someuser')
112 112 p = fast_create(Profile)
113 113 a = fast_create(Article, :published => false, :profile_id => p.id)
114 114 fast_create(Article, :profile_id => p.id)
115   -
  115 +
116 116 user.generate_private_token!
117 117 User.expects(:find_by_private_token).returns(user)
118 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 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 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 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 3 class ActiveSupport::TestCase
4 4  
... ...