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

+ (Boolean) can_check_pending_migrations?

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

+ (Boolean) can_maintain_test_schema?

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

+ (Boolean) has_1_9_hash_syntax?

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
# File 'lib/rspec/rails/feature_check.rb', line 41
def has_1_9_hash_syntax?
  ::Rails::VERSION::STRING > '4.0'
end

+ (Boolean) has_action_mailer?

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

+ (Boolean) has_action_mailer_preview?

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

+ (Boolean) has_active_job?

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

+ (Boolean) has_active_record?

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

+ (Boolean) has_active_record_migration?

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

+ (Object) type_metatag(type)

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.

45
46
47
48
49
50
51
# File 'lib/rspec/rails/feature_check.rb', line 45
def type_metatag(type)
  if has_1_9_hash_syntax?
    "type: :#{type}"
  else
    ":type => :#{type}"
  end
end