diff --git a/test/unit/api/api_test.rb b/test/unit/api/api_test.rb index af3c89c..f731383 100644 --- a/test/unit/api/api_test.rb +++ b/test/unit/api/api_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/test_helper' +require_relative 'test_helper' class MyPlugin < Noosfero::Plugin;end class MyPlugin::API;end diff --git a/test/unit/api/articles_test.rb b/test/unit/api/articles_test.rb index ca0399d..3e9e58f 100644 --- a/test/unit/api/articles_test.rb +++ b/test/unit/api/articles_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/test_helper' +require_relative 'test_helper' class ArticlesTest < ActiveSupport::TestCase diff --git a/test/unit/api/categories_test.rb b/test/unit/api/categories_test.rb index 24b8244..04466b3 100644 --- a/test/unit/api/categories_test.rb +++ b/test/unit/api/categories_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/test_helper' +require_relative 'test_helper' class CategoriesTest < ActiveSupport::TestCase diff --git a/test/unit/api/comments_test.rb b/test/unit/api/comments_test.rb index 0a718ea..5115297 100644 --- a/test/unit/api/comments_test.rb +++ b/test/unit/api/comments_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/test_helper' +require_relative 'test_helper' class CommentsTest < ActiveSupport::TestCase diff --git a/test/unit/api/communities_test.rb b/test/unit/api/communities_test.rb index 029d564..7ced638 100644 --- a/test/unit/api/communities_test.rb +++ b/test/unit/api/communities_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/test_helper' +require_relative 'test_helper' class CommunitiesTest < ActiveSupport::TestCase diff --git a/test/unit/api/enterprises_test.rb b/test/unit/api/enterprises_test.rb index 3774d0a..a3e25d4 100644 --- a/test/unit/api/enterprises_test.rb +++ b/test/unit/api/enterprises_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/test_helper' +require_relative 'test_helper' class EnterprisesTest < ActiveSupport::TestCase diff --git a/test/unit/api/helpers_test.rb b/test/unit/api/helpers_test.rb index deaf85e..6c7d19e 100644 --- a/test/unit/api/helpers_test.rb +++ b/test/unit/api/helpers_test.rb @@ -1,5 +1,5 @@ -require File.dirname(__FILE__) + '/test_helper' -require File.expand_path(File.dirname(__FILE__) + "/../../../lib/noosfero/api/helpers") +require_relative 'test_helper' +require 'noosfero/api/helpers' class APIHelpersTest < ActiveSupport::TestCase @@ -54,35 +54,35 @@ class APIHelpersTest < ActiveSupport::TestCase should 'limit be defined as the params limit value' do local_limit = 30 self.params= {:limit => local_limit} - assert_equal local_limit, limit + assert_equal local_limit, limit end should 'return default limit if the limit parameter is minor than zero' do self.params= {:limit => -1} - assert_equal 20, limit + assert_equal 20, limit end should 'the default limit be 20' do - assert_equal 20, limit + assert_equal 20, limit end should 'the beginning of the period be the first existent date if no from date is passsed as parameter' do assert_equal Time.at(0).to_datetime, period(nil, nil).to_a[0] - end + end should 'the beginning of the period be from date passsed as parameter' do from = DateTime.now assert_equal from, period(from, nil).min - end + end should 'the end of the period be now if no until date is passsed as parameter' do assert_in_delta DateTime.now, period(nil, nil).max - end + end should 'the end of the period be until date passsed as parameter' do until_date = DateTime.now assert_equal until_date, period(nil, until_date).max - end + end should 'parse_content_type return nil if its blank' do assert_nil parse_content_type("") @@ -96,23 +96,23 @@ class APIHelpersTest < ActiveSupport::TestCase assert_equivalent ['TextArticle','TinyMceArticle'], parse_content_type("TextArticle,TinyMceArticle") end - should 'find_article return article by id in list passed for user with permission' do + should 'find_article return article by id in list passed for user with permission' do user = create_user('someuser') a = fast_create(Article, :profile_id => user.person.id) fast_create(Article, :profile_id => user.person.id) fast_create(Article, :profile_id => user.person.id) - + user.generate_private_token! User.expects(:find_by_private_token).returns(user) assert_equal a, find_article(user.person.articles, a.id) end - should 'find_article return forbidden when a user try to access an article without permission' do + should 'find_article return forbidden when a user try to access an article without permission' do user = create_user('someuser') p = fast_create(Profile) a = fast_create(Article, :published => false, :profile_id => p.id) fast_create(Article, :profile_id => p.id) - + user.generate_private_token! User.expects(:find_by_private_token).returns(user) assert_equal 403, find_article(p.articles, a.id).last diff --git a/test/unit/api/people_test.rb b/test/unit/api/people_test.rb index e35f8eb..5f20472 100644 --- a/test/unit/api/people_test.rb +++ b/test/unit/api/people_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/test_helper' +require_relative 'test_helper' class PeopleTest < ActiveSupport::TestCase diff --git a/test/unit/api/session_test.rb b/test/unit/api/session_test.rb index 84e4712..ff1e7a2 100644 --- a/test/unit/api/session_test.rb +++ b/test/unit/api/session_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/test_helper' +require_relative 'test_helper' class SessionTest < ActiveSupport::TestCase diff --git a/test/unit/api/task_test.rb b/test/unit/api/task_test.rb index 81ccb09..01bf515 100644 --- a/test/unit/api/task_test.rb +++ b/test/unit/api/task_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/test_helper' +require_relative 'test_helper' class TasksTest < ActiveSupport::TestCase diff --git a/test/unit/api/test_helper.rb b/test/unit/api/test_helper.rb index 4c714c3..7cc9f3e 100644 --- a/test/unit/api/test_helper.rb +++ b/test/unit/api/test_helper.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/../../test_helper' +require 'test_helper' class ActiveSupport::TestCase -- libgit2 0.21.2