spec/spec_helper.rb in with_model-2.0.0 vs spec/spec_helper.rb in with_model-2.1.0
- old
+ new
@@ -1,14 +1,10 @@
+# frozen_string_literal: true
+
require 'bundler'
Bundler.setup
-begin
- require 'coveralls'
- Coveralls.wear!
-rescue LoadError
-end
-
require 'with_model'
RSpec.configure do |config|
config.extend WithModel
config.warnings = true
@@ -20,17 +16,17 @@
config.mock_with :rspec do |c|
c.syntax = :expect
end
end
-is_jruby = RUBY_PLATFORM =~ /\bjava\b/
+is_jruby = RUBY_PLATFORM == 'java'
adapter = is_jruby ? 'jdbcsqlite3' : 'sqlite3'
# WithModel requires ActiveRecord::Base.connection to be established.
# If ActiveRecord already has a connection, as in a Rails app, this is unnecessary.
require 'active_record'
-ActiveRecord::Base.establish_connection(:adapter => adapter, :database => ':memory:')
+ActiveRecord::Base.establish_connection(adapter: adapter, database: ':memory:')
if defined?(I18n) && I18n.respond_to?(:enforce_available_locales=)
I18n.enforce_available_locales = true
end
@@ -39,16 +35,17 @@
ActiveRecord::Base.logger = Logger.new($stdout)
end
module SpecHelper
module RailsTestCompatability
- if ::ActiveRecord::VERSION::STRING >= '4.1.0'
- require 'minitest'
- include Minitest::Assertions
- def assertions; @assertions ||= 0; end
- def assertions= value; @assertions = value; end
- else
- require 'test/unit/assertions'
- include Test::Unit::Assertions
+ require 'minitest'
+ include Minitest::Assertions
+
+ def assertions
+ @assertions ||= 0
+ end
+
+ def assertions=(value)
+ @assertions = value
end
end
end