Skip to content

Commit

Permalink
Merge branch 'release/0.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
haru committed Sep 11, 2017
2 parents 2942442 + 9f40251 commit ac736d0
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 13 deletions.
1 change: 1 addition & 0 deletions .coveralls.yml
@@ -0,0 +1 @@
service_name: travis-ci
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
Gemfile
coverage
16 changes: 16 additions & 0 deletions .travis.yml
@@ -0,0 +1,16 @@
language: ruby
rvm:
- 2.2
- 2.3
env:
- REDMINE_VER=3.4-stable
script:
- export TESTSPACE=`pwd`/testspace
- export NAME_OF_PLUGIN=redmine_theme_changer
- export PATH_TO_PLUGIN=`pwd`
- export PATH_TO_REDMINE=$TESTSPACE/redmine
- mkdir $TESTSPACE
- bash -x ./travis.sh
notifications:
slack:
secure: jSLfRVOZWn/hrwNKInpMKdkEaD7VuOF0tn893qCEzSwLfv2BWItJFSSLgNzug8uHcqo2DCngKzhqeNCqdiaF8i7sMybGAzvmm8HpS2iKM/EFyKNKc34r/IyaEcKabblEg66JREoz4Ovy4csQJN/r4lngis4xqZx77hMZMb8WOLRCN+2lkoQJxESTlb+4HWwx6vMZIjvKywgXhh/pqxbq4sRGseNhN3RXc4j2b4b73IkKMzy9my2vReXnh4cEDvDeG0afspOb/b3qe12iVYVGInAH1Nq5/HF4+HcJwQUohWPQUXMcgvnwgW4YG1flaVp6XXleB9XuSSJZIwOUtEMbTA9akRMfujMBtldlOhEw+hBC+iyIs7vz+F2nvAbTy5gja0Kip9Ve2Zs3PsiyeUS3KMC0DvoTdyU7qyiiAN3Djlb9HRUTBg0YSWmjC4aPBMB1mk6+Hot8efRrfQR1+fTNrhVNlndzLG5NzRCkzk2tlpqbUrKMzc1eHavPJF9uFqcTNXazUIlfYq7AK3jRa+VqaenIIy1gAxFPCNq6FWQF2D6H5lsauazGkcIGant4Lj5dSWlgsOgvuWKbQ6PMe1Xd3yjkL5XR5ygvppHocQebDYJ6l4+tvFj3Rzg8j0oxy3Vmo5u2byxM/IbGLCZcLIsFNpxCqMp+SwhKkNKU2g4+x2E=
6 changes: 6 additions & 0 deletions Gemfile_for_test
@@ -0,0 +1,6 @@
source :rubygems

group :test do
gem "simplecov-rcov"
gem 'coveralls', :require => false
end
1 change: 1 addition & 0 deletions README.rdoc
Expand Up @@ -22,4 +22,5 @@ http://www.r-labs.org/projects/themechanger
* cs.yml - Wohnivec
* pt-BR.yml - Adriano Baptistella
* zy.yml - Steven.W
* ru.yml - Danil intl

4 changes: 2 additions & 2 deletions init.rb
@@ -1,5 +1,5 @@
# Theme Changer plugin for Redmine
# Copyright (C) 2010-2015 Haruyuki Iida
# Copyright (C) 2010-2017 Haruyuki Iida
#rev
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -33,7 +33,7 @@
name 'Redmine Theme Changer plugin'
author 'Haruyuki Iida'
description 'Lets each user select a theme for Redmine'
version '0.3.0'
version '0.3.1'
url 'http://www.r-labs.org/projects/themechanger'
author_url 'http://twitter.com/haru_iida'
requires_redmine :version_or_higher => '3.4.0'
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/theme_changer_user_settings.yml
Expand Up @@ -4,16 +4,16 @@ one:

user_id: 1

theme: MyString
theme: classic

updated_at: 2010-07-24 10:05:13

two:
id: 2

user_id: 1
user_id: 2

theme: MyString
theme: alternate

updated_at: 2010-07-24 10:05:13

19 changes: 16 additions & 3 deletions test/test_helper.rb
@@ -1,5 +1,18 @@
# Load the normal Rails helper
require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper')
require 'simplecov'
require 'simplecov-rcov'
require 'coveralls'

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::RcovFormatter,
Coveralls::SimpleCov::Formatter
]

SimpleCov.start do
root File.expand_path(File.dirname(__FILE__) + '/..')
add_filter "/test/"
end

require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper')

# Ensure that we are using the temporary fixture path
Engines::Testing.set_fixture_path
#Engines::Testing.set_fixture_path
11 changes: 6 additions & 5 deletions test/unit/theme_changer_user_setting_test.rb
@@ -1,10 +1,11 @@
require File.dirname(__FILE__) + '/../test_helper'
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

class ThemeChangerUserSettingTest < ActiveSupport::TestCase
fixtures :theme_changer_user_settings
fixtures :theme_changer_user_settings, :users

# Replace this with your real tests.
def test_truth
assert true
def test_find_theme_by_user_id
setting = ThemeChangerUserSetting.find_theme_by_user_id 1
assert_equal(1, setting.user.id)
assert_equal('classic', setting.theme)
end
end
78 changes: 78 additions & 0 deletions travis.sh
@@ -0,0 +1,78 @@
#!/bin/bash

#/bin/bash

set -e

if [[ ! "$TESTSPACE" = /* ]] ||
[[ ! "$PATH_TO_REDMINE" = /* ]] ||
[[ ! "$REDMINE_VER" = * ]] ||
[[ ! "$NAME_OF_PLUGIN" = * ]] ||
[[ ! "$PATH_TO_PLUGIN" = /* ]];
then
echo "You should set"\
" TESTSPACE, PATH_TO_REDMINE, REDMINE_VER"\
" NAME_OF_PLUGIN, PATH_TO_PLUGIN"\
" environment variables"
echo "You set:"\
"$TESTSPACE"\
"$PATH_TO_REDMINE"\
"$REDMINE_VER"\
"$NAME_OF_PLUGIN"\
"$PATH_TO_PLUGIN"
exit 1;
fi

export RAILS_ENV=test

export REDMINE_GIT_REPO=git://github.com/redmine/redmine.git
export REDMINE_GIT_TAG=$REDMINE_VER
export BUNDLE_GEMFILE=$PATH_TO_REDMINE/Gemfile

if [ -f Gemfile_for_test ]
then
cp Gemfile_for_test Gemfile
fi

# checkout redmine
git clone $REDMINE_GIT_REPO $PATH_TO_REDMINE
if [ -d test/fixtures ]
then
cp test/fixtures/* ${PATH_TO_REDMINE}/test/fixtures/
fi

cd $PATH_TO_REDMINE
if [ ! "$REDMINE_GIT_TAG" = "master" ];
then
git checkout -b $REDMINE_GIT_TAG origin/$REDMINE_GIT_TAG
fi

# create a link to the backlogs plugin
ln -sf $PATH_TO_PLUGIN plugins/$NAME_OF_PLUGIN


cat << EOS > config/database.yml
test:
adapter: sqlite3
database: db/test.sqlite3
EOS


# install gems
bundle install

# run redmine database migrations
bundle exec rake db:migrate

# run plugin database migrations
bundle exec rake redmine:plugins:migrate

# install redmine database
#bundle exec rake redmine:load_default_data REDMINE_LANG=en

bundle exec rake db:structure:dump

# run tests
# bundle exec rake TEST=test/unit/role_test.rb
bundle exec rake redmine:plugins:test NAME=$NAME_OF_PLUGIN

0 comments on commit ac736d0

Please sign in to comment.