diff --git a/.travis.yml b/.travis.yml index 3aefec912..5f2219acd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,7 @@ before_install: - phantomjs --version before_script: - bundle exec rake db:create db:migrate db:test:prepare + - bundle exec rake assets:precompile script: - bundle exec rubocop --display-cop-names --rails - script/gemfile_check diff --git a/app/helpers/plantings_helper.rb b/app/helpers/plantings_helper.rb index e237ae27d..a9cfebf61 100644 --- a/app/helpers/plantings_helper.rb +++ b/app/helpers/plantings_helper.rb @@ -4,7 +4,7 @@ module PlantingsHelper 0 elsif !planting.finished_at.nil? ((p = planting.finished_at - DateTime.now).to_i) <= 0 ? 0 : p.to_i - elsif planting.days_before_maturity.nil? + elsif planting.planted_at.nil? || planting.days_before_maturity.nil? "unknown" else ((p = (planting.planted_at + planting.days_before_maturity) - DateTime.now).to_i <= 0) ? 0 : p.to_i diff --git a/config/environments/test.rb b/config/environments/test.rb index 35836c90b..dd3a3816c 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -6,6 +6,10 @@ Growstuff::Application.configure do # preloads Rails for running tests, you may have to set it to true. config.eager_load = false + # Do not compile assets on-demand. On-demand compilation slows down the test + # suite and causes random test failures. + config.assets.compile = false + # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped diff --git a/lib/tasks/testing.rake b/lib/tasks/testing.rake index a7908d590..b41172efb 100644 --- a/lib/tasks/testing.rake +++ b/lib/tasks/testing.rake @@ -2,7 +2,7 @@ require 'rake' begin require 'rspec/core/rake_task' task(:spec).clear - RSpec::Core::RakeTask.new(spec: 'db:test:prepare') do |t| + RSpec::Core::RakeTask.new(spec: ['db:create', 'db:test:prepare']) do |t| t.verbose = false end rescue LoadError