module RSpec::Rails::FeatureCheck
@private Disable some cops until github.com/bbatsov/rubocop/issues/1310 rubocop:disable Style/IndentationConsistency
Public Instance Methods
can_check_pending_migrations?()
click to toggle source
rubocop:enable Style/IndentationWidth
# File lib/rspec/rails/feature_check.rb, line 11 def can_check_pending_migrations? has_active_record_migration? && ::ActiveRecord::Migration.respond_to?(:check_pending!) end
can_maintain_test_schema?()
click to toggle source
# File lib/rspec/rails/feature_check.rb, line 16 def can_maintain_test_schema? has_active_record_migration? && ::ActiveRecord::Migration.respond_to?(:maintain_test_schema!) end
has_1_9_hash_syntax?()
click to toggle source
# File lib/rspec/rails/feature_check.rb, line 46 def has_1_9_hash_syntax? ::Rails::VERSION::STRING > '4.0' end
has_action_mailer?()
click to toggle source
# File lib/rspec/rails/feature_check.rb, line 33 def has_action_mailer? defined?(::ActionMailer) end
has_action_mailer_preview?()
click to toggle source
# File lib/rspec/rails/feature_check.rb, line 37 def has_action_mailer_preview? has_action_mailer? && defined?(::ActionMailer::Preview) end
has_action_mailer_show_preview?()
click to toggle source
# File lib/rspec/rails/feature_check.rb, line 41 def has_action_mailer_show_preview? has_action_mailer_preview? && ::ActionMailer::Base.respond_to?(:show_previews=) end
has_active_job?()
click to toggle source
# File lib/rspec/rails/feature_check.rb, line 21 def has_active_job? defined?(::ActiveJob) end
has_active_record?()
click to toggle source
# File lib/rspec/rails/feature_check.rb, line 25 def has_active_record? defined?(::ActiveRecord) end
has_active_record_migration?()
click to toggle source
# File lib/rspec/rails/feature_check.rb, line 29 def has_active_record_migration? has_active_record? && defined?(::ActiveRecord::Migration) end
has_file_fixture?()
click to toggle source
# File lib/rspec/rails/feature_check.rb, line 50 def has_file_fixture? ::Rails::VERSION::STRING > '5.0' end
type_metatag(type)
click to toggle source
# File lib/rspec/rails/feature_check.rb, line 54 def type_metatag(type) if has_1_9_hash_syntax? "type: :#{type}" else ":type => :#{type}" end end