Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.

Commit

Permalink
Merge pull request #92 from akiko-pusu/dev
Browse files Browse the repository at this point in the history
Prevent run rake task without test env and specifying task name.
  • Loading branch information
akiko-pusu committed Jul 2, 2017
2 parents 02878e6 + 0645c78 commit 5ae2241
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
@@ -1 +1,4 @@
inherit_from: .rubocop_todo.yml
AllCops:
# TODO: Change TargetRubyVersion to 2.0 or higher, when Redmine cloded to support ruby 1.9x.
TargetRubyVersion: 1.9
2 changes: 1 addition & 1 deletion init.rb
Expand Up @@ -8,7 +8,7 @@
author 'Akiko Takano'
author_url 'http://twitter.com/akiko_pusu'
description 'Plugin to show site-wide message, such as maintenacne informations or notifications.'
version '0.1.2-dev'
version '0.1.2'
requires_redmine version_or_higher: '2.5.0'
url 'https://github.com/akiko-pusu/redmine_banner'

Expand Down
5 changes: 3 additions & 2 deletions lib/tasks/test.rake
@@ -1,8 +1,9 @@
namespace :redmine_banner do
desc 'Run test for redmine_banner plugin.'
task default: :test
task :test do |task_name|
next unless ENV['RAILS_ENV'] == 'test' && task_name.name == 'redmine_banner:test'
end

desc 'Run test for redmine_banner plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'plugins/redmine_banner/test/**/*_test.rb'
Expand Down
15 changes: 13 additions & 2 deletions test/test_helper.rb
@@ -1,5 +1,16 @@
require 'simplecov'
require 'simplecov-rcov'
begin
require 'simplecov'
require 'simplecov-rcov'
rescue LoadError => ex
puts <<-"EOS"
This test should be called only for redmine banner test.
Test exit with LoadError -- #{ex.message}
Please move redmine_banner/Gemfile.local to redmine_issue_templates/Gemfile
and run bundle install if you want to to run tests.
EOS
exit
end

if ENV['JENKINS'] == 'true'
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
end
Expand Down

0 comments on commit 5ae2241

Please sign in to comment.