#233 Failed Travis builds
This commit is contained in:
parent
3cda9e1254
commit
c2a40de2ba
@ -45,10 +45,6 @@ run_tests()
|
|||||||
|
|
||||||
cd $PATH_TO_REDMINE
|
cd $PATH_TO_REDMINE
|
||||||
|
|
||||||
|
|
||||||
#mkdir -p coverage
|
|
||||||
#ln -sf `pwd`/coverage $WORKSPACE
|
|
||||||
|
|
||||||
# Run tests within application - for some reason redmine:plugins:test wont work under 1.8
|
# 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
|
bundle exec rake redmine:plugins:test:units NAME=redmine_dmsf
|
||||||
bundle exec rake redmine:plugins:test:functionals NAME=redmine_dmsf
|
bundle exec rake redmine:plugins:test:functionals NAME=redmine_dmsf
|
||||||
@ -58,10 +54,11 @@ run_tests()
|
|||||||
uninstall()
|
uninstall()
|
||||||
{
|
{
|
||||||
set -e # exit if migrate fails
|
set -e # exit if migrate fails
|
||||||
|
|
||||||
cd $PATH_TO_REDMINE
|
cd $PATH_TO_REDMINE
|
||||||
|
|
||||||
# clean up database
|
# 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=test
|
||||||
#bundle exec rake $MIGRATE_PLUGINS NAME=redmine_dmsf VERSION=0 RAILS_ENV=development
|
|
||||||
}
|
}
|
||||||
|
|
||||||
run_install()
|
run_install()
|
||||||
@ -76,8 +73,6 @@ run_install()
|
|||||||
# create a link to the dmsf plugin
|
# create a link to the dmsf plugin
|
||||||
ln -sf $PATH_TO_DMSF $PATH_TO_PLUGINS/redmine_dmsf
|
ln -sf $PATH_TO_DMSF $PATH_TO_PLUGINS/redmine_dmsf
|
||||||
|
|
||||||
#ignore redmine-master's test-unit dependency, we need 1.2.3
|
|
||||||
#sed -i -e 's=.*gem ["'\'']test-unit["'\''].*==g' ${PATH_TO_REDMINE}/Gemfile
|
|
||||||
# install gems
|
# install gems
|
||||||
mkdir -p vendor/bundle
|
mkdir -p vendor/bundle
|
||||||
|
|
||||||
@ -90,10 +85,8 @@ run_install()
|
|||||||
|
|
||||||
# run redmine database migrations
|
# run redmine database migrations
|
||||||
bundle exec rake db:migrate RAILS_ENV=test --trace
|
bundle exec rake db:migrate RAILS_ENV=test --trace
|
||||||
#bundle exec rake db:migrate RAILS_ENV=development --trace
|
|
||||||
|
|
||||||
# Load redmine database default data
|
# 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
|
bundle exec rake redmine:load_default_data REDMINE_LANG=en RAILS_ENV=test
|
||||||
|
|
||||||
# generate session store/secret token
|
# generate session store/secret token
|
||||||
@ -104,7 +97,6 @@ run_install()
|
|||||||
|
|
||||||
# run dmsf database migrations
|
# run dmsf database migrations
|
||||||
bundle exec rake $MIGRATE_PLUGINS RAILS_ENV=test
|
bundle exec rake $MIGRATE_PLUGINS RAILS_ENV=test
|
||||||
#bundle exec rake $MIGRATE_PLUGINS RAILS_ENV=development
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts :irtu opt
|
while getopts :irtu opt
|
||||||
|
|||||||
@ -21,35 +21,49 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
class DmsfFilesControllerTest < RedmineDmsf::Test::TestCase
|
class DmsfFilesControllerTest < RedmineDmsf::Test::TestCase
|
||||||
|
|
||||||
fixtures :users, :dmsf_files, :dmsf_file_revisions, :custom_fields,
|
fixtures :users, :dmsf_files, :dmsf_file_revisions, :custom_fields,
|
||||||
:custom_values, :projects, :members, :member_roles, :enabled_modules,
|
:custom_values, :projects, :roles, :members, :member_roles, :enabled_modules,
|
||||||
:dmsf_file_revisions
|
:dmsf_file_revisions
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@request.session[:user_id] = 2
|
@project = Project.find_by_id 1
|
||||||
@file = DmsfFolder.find_by_id 1
|
assert_not_nil @project
|
||||||
|
@project.enable_module! :dmsf
|
||||||
|
@user = User.find_by_id 2
|
||||||
|
assert_not_nil @user
|
||||||
|
@request.session[:user_id] = @user.id
|
||||||
|
@file = DmsfFile.find_by_id 1
|
||||||
@role = Role.find_by_id 1
|
@role = Role.find_by_id 1
|
||||||
@custom_field = CustomField.find_by_id 21
|
@custom_field = CustomField.find_by_id 21
|
||||||
@custom_value_2 = CustomValue.find_by_id 22
|
@custom_value = CustomValue.find_by_id 22
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_truth
|
||||||
|
assert_kind_of Project, @project
|
||||||
|
assert_kind_of User, @user
|
||||||
|
assert_kind_of DmsfFile, @file
|
||||||
|
assert_kind_of Role, @role
|
||||||
|
assert_kind_of CustomField, @custom_field
|
||||||
|
assert_kind_of CustomValue, @custom_value
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_file
|
def test_show_file
|
||||||
# Missing permissions
|
# Missing permissions
|
||||||
get :show, :id => @file
|
get :show, :id => @file.id
|
||||||
assert_response 403
|
assert_response 403
|
||||||
|
|
||||||
# Permissions OK
|
# Permissions OK
|
||||||
@role.add_permission! :view_dmsf_files
|
@role.add_permission! :view_dmsf_files
|
||||||
@role.add_permission! :file_manipulation
|
@role.add_permission! :file_manipulation
|
||||||
get :show, :id => @file
|
get :show, :id => @file.id
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
# The last revision
|
# The last revision
|
||||||
assert_select 'label', {:text => @custom_field.name}
|
assert_select 'label', { :text => @custom_field.name }
|
||||||
assert_select '.customfield', {:text => "#{@custom_field.name}: #{@custom_value_2.value}"}
|
assert_select '.customfield', { :text => "#{@custom_field.name}: #{@custom_value.value}" }
|
||||||
|
|
||||||
# A new revision
|
# A new revision
|
||||||
assert_select 'label', {:text => @custom_field.name}
|
assert_select 'label', { :text => @custom_field.name }
|
||||||
assert_select 'option', {:value => @custom_value_2.value}
|
assert_select 'option', { :value => @custom_value.value }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user