Module: RSpec::Rails::FeatureCheck Private

Defined in:
lib/rspec/rails/feature_check.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Disable some cops until https://github.com/bbatsov/rubocop/issues/1310 rubocop:disable Style/IndentationConsistency

Class Method Summary collapse

Class Method Details

.can_check_pending_migrations?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

rubocop:enable Style/IndentationWidth

Returns:

  • (Boolean)


11
12
13
14
# 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?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


16
17
18
19
# 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?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


46
47
48
# File 'lib/rspec/rails/feature_check.rb', line 46

def has_1_9_hash_syntax?
  ::Rails::VERSION::STRING > '4.0'
end

.has_action_mailer?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


33
34
35
# File 'lib/rspec/rails/feature_check.rb', line 33

def has_action_mailer?
  defined?(::ActionMailer)
end

.has_action_mailer_preview?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


37
38
39
# 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?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


41
42
43
44
# 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?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


21
22
23
# File 'lib/rspec/rails/feature_check.rb', line 21

def has_active_job?
  defined?(::ActiveJob)
end

.has_active_record?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


25
26
27
# File 'lib/rspec/rails/feature_check.rb', line 25

def has_active_record?
  defined?(::ActiveRecord)
end

.has_active_record_migration?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


29
30
31
# File 'lib/rspec/rails/feature_check.rb', line 29

def has_active_record_migration?
  has_active_record? && defined?(::ActiveRecord::Migration)
end

.type_metatag(type) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



50
51
52
53
54
55
56
# File 'lib/rspec/rails/feature_check.rb', line 50

def type_metatag(type)
  if has_1_9_hash_syntax?
    "type: :#{type}"
  else
    ":type => :#{type}"
  end
end