Sha256: 113a1cf3b806b7ac0b0cf8e7f246c4aaca2389b4f7ab0802871751e86e26eefc
Contents?: true
Size: 1.23 KB
Versions: 16
Compression:
Stored size: 1.23 KB
Contents
require 'spec_helper' require_relative '../../lib/qbrick/touch_placeholders' describe Qbrick::TouchPlaceholders do before :all do m = ActiveRecord::Migration.new m.verbose = false m.create_table :dummy_models do |t| t.timestamps end class DummyModel < ActiveRecord::Base include Qbrick::TouchPlaceholders end @page = FactoryGirl.create(:page) @placeholder = FactoryGirl.create(:placeholder_brick, brick_list: @page, template_name: 'foo') end after :all do m = ActiveRecord::Migration.new m.verbose = false m.drop_table :dummy_models @page.destroy @placeholder.destroy end describe 'placeholder_templates class method' do it 'returns the attribute names defined with class macro' do DummyModel.class_eval { placeholder_templates 'key_benefit_slider', 'key_benefit_grid' } expect(DummyModel.placeholder_templates).to eq %w(key_benefit_slider key_benefit_grid) end end describe 'after_save_callback' do it 'looks for the bricks with affected templates and touches them' do DummyModel.class_eval { placeholder_templates 'foo' } expect_any_instance_of(Qbrick::PlaceholderBrick).to receive(:touch) DummyModel.create end end end
Version data entries
16 entries across 16 versions & 1 rubygems