From 3cda9e1254e13cf4e3e0294008894be60ce26193 Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Tue, 11 Mar 2014 11:01:14 +0100 Subject: [PATCH] #233 Failed Travis builds --- lib/redmine_dmsf/test/unit_test.rb | 18 +++++++++++++----- test/ci/redmine_install.sh | 17 +++++++++-------- test/test_helper.rb | 11 ++++------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/lib/redmine_dmsf/test/unit_test.rb b/lib/redmine_dmsf/test/unit_test.rb index 73a4fdab..315a20e1 100644 --- a/lib/redmine_dmsf/test/unit_test.rb +++ b/lib/redmine_dmsf/test/unit_test.rb @@ -18,6 +18,12 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Load the normal Rails helper +#require File.expand_path("#{Rails.root}/test/test_helper") + +# Use fixtures from redmine +#ActiveSupport::TestCase.fixture_path = "#{Rails.root}/test/fixtures" + module RedmineDmsf module Test class UnitTest < ActiveSupport::TestCase @@ -25,11 +31,13 @@ module RedmineDmsf # Allow us to override the fixtures method to implement fixtures for our plugin. # Ultimately it allows for better integration without blowing redmine fixtures up, # and allowing us to suppliment redmine fixtures if we need to. - def self.fixtures(*table_names) - dir = File.expand_path( File.dirname(__FILE__) + '../../../../test/fixtures') - table_names.each{|x,i| - ActiveRecord::Fixtures.create_fixtures(dir, x) if File.exist?("#{dir}/#{x}.yml") - } + def self.fixtures(*table_names) + dir = File.expand_path('../../../../test/fixtures', __FILE__) + table_names.each do |x| + if File.exist?("#{dir}/#{x}.yml") + ActiveRecord::Fixtures.create_fixtures(dir, x) + end + end super(table_names) end diff --git a/test/ci/redmine_install.sh b/test/ci/redmine_install.sh index 46af836a..da745b0f 100644 --- a/test/ci/redmine_install.sh +++ b/test/ci/redmine_install.sh @@ -46,8 +46,8 @@ run_tests() cd $PATH_TO_REDMINE - mkdir -p coverage - ln -sf `pwd`/coverage $WORKSPACE + #mkdir -p coverage + #ln -sf `pwd`/coverage $WORKSPACE # Run tests within application - for some reason redmine:plugins:test wont work under 1.8 bundle exec rake redmine:plugins:test:units NAME=redmine_dmsf @@ -61,7 +61,7 @@ uninstall() cd $PATH_TO_REDMINE # clean up database bundle exec rake $MIGRATE_PLUGINS NAME=redmine_dmsf VERSION=0 RAILS_ENV=test - bundle exec rake $MIGRATE_PLUGINS NAME=redmine_dmsf VERSION=0 RAILS_ENV=development + #bundle exec rake $MIGRATE_PLUGINS NAME=redmine_dmsf VERSION=0 RAILS_ENV=development } run_install() @@ -90,20 +90,21 @@ run_install() # run redmine database migrations bundle exec rake db:migrate RAILS_ENV=test --trace - bundle exec rake db:migrate RAILS_ENV=development --trace + #bundle exec rake db:migrate RAILS_ENV=development --trace - # install redmine database - bundle exec rake redmine:load_default_data REDMINE_LANG=en RAILS_ENV=development + # Load redmine database default data + #bundle exec rake redmine:load_default_data REDMINE_LANG=en RAILS_ENV=development + bundle exec rake redmine:load_default_data REDMINE_LANG=en RAILS_ENV=test # generate session store/secret token bundle exec rake $GENERATE_SECRET # enable development features - touch dmsf.dev + #touch dmsf.dev # run dmsf database migrations bundle exec rake $MIGRATE_PLUGINS RAILS_ENV=test - bundle exec rake $MIGRATE_PLUGINS RAILS_ENV=development + #bundle exec rake $MIGRATE_PLUGINS RAILS_ENV=development } while getopts :irtu opt diff --git a/test/test_helper.rb b/test/test_helper.rb index 0cb8c185..3274dc6c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,7 +1,8 @@ # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011 Vít Jonáš -# Copyright (C) 2012 Daniel Munn +# Copyright (C) 2011 Vít Jonáš +# Copyright (C) 2012 Daniel Munn +# Copyright (C) 2011-14 Karel Picman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,8 +19,4 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Load the normal Rails helper -require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper') - -# Use fixtures from redmine -ActiveSupport::TestCase.fixture_path = File.dirname(__FILE__) + '/../../../test/fixtures' - +require File.expand_path('../../../../test/test_helper', __FILE__) \ No newline at end of file