spec/spec_helper.rb in activeadmin-axlsx-1.0.0 vs spec/spec_helper.rb in activeadmin-axlsx-2.0.0
- old
+ new
@@ -1,22 +1,24 @@
-require 'rails'
-require 'activeadmin'
+require 'simplecov'
+SimpleCov.start do
+ add_filter "/rails/"
+end
+# prepare ENV for rails
+require 'rails'
ENV['RAILS_ROOT'] = File.expand_path("../rails/rails-#{Rails::VERSION::STRING}", __FILE__)
+# ensure testing application is in place
unless File.exists?(ENV['RAILS_ROOT'])
puts "Please run bundle exec rake setup before running the specs."
exit
end
-def load_defaults!
- ActiveAdmin.unload!
- ActiveAdmin.load!
- ActiveAdmin.register(Category)
- ActiveAdmin.register(User)
- ActiveAdmin.register(Post){ belongs_to :user, :optional => true }
-end
-
-ENV['RAILS_ENV'] = 'test'
+# load up activeadmin and activeadmin-axlsx
+require 'activeadmin-axlsx'
ActiveAdmin.application.load_paths = [ENV['RAILS_ROOT'] + "/app/admin"]
+
+# start up rails
require ENV['RAILS_ROOT'] + '/config/environment'
-require 'activeadmin-axlsx'
+
+# and finally,here's rspec
+require 'rspec/rails'