Sha256: 067683acd5a41f24287b1ecd4f667c71a9d07ca0890651eba8b3b275bcaaf0ed
Contents?: true
Size: 1.42 KB
Versions: 3
Compression:
Stored size: 1.42 KB
Contents
require "active_record_mocks" module TestingModels def around(&block) with_testing_models(&block) end def with_testing_models with_mocked_tables do |m| m.enable_extension "hstore" m.create_table do |t| t.model_name :TestModel t.parent_class "Lanes::Model" t.belongs_to :bt, class_name: 'Tmbt' t.has_many :hm, class_name: 'Tmhm' t.layout do |l| l.integer :bt_id l.string :name, :number end end TestModel.export_associations( :bt, :hm, writable: true ) m.create_table do |t| t.model_name :Tmbt t.parent_class "Lanes::Model" t.layout do |l| l.string :description, :secret_field, :notes end end m.create_table do |t| t.model_name :Tmhm t.parent_class "Lanes::Model" t.layout do |l| l.integer :test_model_id l.string :description, :secret_field, :notes end end Tmhm.blacklist_attributes :secret_field # Lanes::Access.calculate_model_access! yield TestModel.blacklisted_attributes.clear if TestModel.blacklisted_attributes end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lanes-0.1.2 | lib/lanes/testing_models.rb |
lanes-0.1.0 | lib/lanes/testing_models.rb |
lanes-0.0.8 | lib/lanes/testing_models.rb |