Module: AccessFixtureTestPatches

Defined in:
lib/hippo/access/test_fixture_extensions.rb

Instance Method Summary collapse

Instance Method Details

#table_rowsObject


3
4
5
6
7
8
9
10
11
12
13
# File 'lib/hippo/access/test_fixture_extensions.rb', line 3

def table_rows
    results = super
    if model_class && model_class < ActiveRecord::Base && model_class.record_modifications
        results[ table_name ].each do | row |
            # 135138680 is the 'admin' user
            row['created_by_id'] ||= 135138680 if model_class.column_names.include?('created_by_id')
            row['updated_by_id'] ||= 135138680 if model_class.column_names.include?('updated_by_id')
        end
    end
    results
end