Skip to content

Commit

Permalink
use a separate RAILS_VERSION=none for testing...
Browse files Browse the repository at this point in the history
... instead of running unit tests twice (with/without rails) for each
rails version.

This commit also catches an issue where genspec is used with Thor (outside
of Rails), because activesupport is an undeclared dependency in that
environment.
  • Loading branch information
sinisterchipmunk committed Jul 1, 2016
1 parent deee9c2 commit 5f3977b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:
- RAILS_VERSION="~> 4.1.0"
- RAILS_VERSION="~> 4.2.0"
- RAILS_VERSION="~> 5.0.0"
- RAILS_VERSION="none"

matrix:
allow_failures:
Expand Down
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ source 'https://rubygems.org'

gemspec

gem 'rails', ENV['RAILS_VERSION'] || '>= 3'
if ENV['RAILS_VERSION'] != 'none'
gem 'rails', ENV['RAILS_VERSION'] || '>= 3'
end
2 changes: 0 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ require 'coveralls/rake/task'
Coveralls::RakeTask.new

task :default do
run "rspec", "spec"
ENV['USE_RAILS'] = '1'
run "rspec", "spec"
Rake::Task['coveralls:push'].invoke
end
Expand Down
2 changes: 2 additions & 0 deletions genspec.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ Gem::Specification.new do |s|

s.add_dependency 'thor'
s.add_dependency 'rspec', '~> 2'
s.add_dependency 'activesupport', '>= 3', '<= 5'

s.add_development_dependency 'coveralls'
s.add_development_dependency 'rake'
end

2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
require 'bundler'
Bundler.setup

if ENV['USE_RAILS']
if ENV['RAILS_VERSION'] != 'none'
require 'rails'
require 'rails/generators'
end
Expand Down

0 comments on commit 5f3977b

Please sign in to comment.