Sha256: c474d02dbfc14bb4518a67ed42c625b16033e929396235db39722bbde2a104c5
Contents?: true
Size: 1.42 KB
Versions: 4
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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
lanes-0.0.5 | spec/testing_models.rb |
lanes-0.0.3 | spec/testing_models.rb |
lanes-0.0.2 | spec/testing_models.rb |
lanes-0.0.1 | spec/testing_models.rb |