Module: Phillumeny::ActiveRecord

Defined in:
lib/phillumeny/active_record.rb,
lib/phillumeny/active_record/have_default_value_of.rb,
lib/phillumeny/active_record/cover_query_with_indexes.rb

Overview

:nodoc:

Defined Under Namespace

Modules: TableInformation Classes: CoverQueryWithIndexes, HaveDefaultValueOf

Instance Method Summary collapse

Instance Method Details

#cover_query_with_indexes(columns) ⇒ Phillumeny::ActiveRecord::CoverQueryWithIndexes

Comb through indexes to ensure the columns are covered

Examples:


[:col1, [:col1, :col2], :col2].each do |columns|
  it { should cover_query_with_indexes columns }
end

Returns:



18
19
20
# File 'lib/phillumeny/active_record/cover_query_with_indexes.rb', line 18

def cover_query_with_indexes(columns)
  CoverQueryWithIndexes.new(columns)
end

#have_default_value_of(default_value) ⇒ Phillumeny::ActiveRecord::HaveADefaultValueOf

Confirm a default value is getting returned as expected

Examples:


{ user_id: nil, timezone: 'PDT' }.each do |attribute, value|
  # Just checks the subject that the right value is present
  it { should have_default_value_of(value).for(attribute) }
end

# Checks both the subject and confirms at the database column level
it { should have_default_value_of('PDT').for(:timezone).in_the_database }

Returns:

  • (Phillumeny::ActiveRecord::HaveADefaultValueOf)


22
23
24
# File 'lib/phillumeny/active_record/have_default_value_of.rb', line 22

def have_default_value_of(default_value)
  HaveDefaultValueOf.new(default_value)
end