Sha256: 7c6f087aa6be207d094097c4d4163217e56049ebd32916e58622ac1536adf4a8
Contents?: true
Size: 1.07 KB
Versions: 9
Compression:
Stored size: 1.07 KB
Contents
require 'spec_helper' describe RSpecCandy::Helpers::Rails::CreateWithoutCallbacks do describe ActiveRecord::Base do describe '.create_without_callbacks' do it 'should create a record without running callbacks or validations' do model = Model.disposable_copy do before_save :crash validate :crash def crash raise 'callback was run' end end record = nil expect do record = model.create_without_callbacks(:string_field => 'foo') end.to_not raise_error record.string_field.should == 'foo' record.should be_a(Model) record.id.should be_a(Fixnum) record.should_not be_new_record end end describe '.new_and_store' do it 'should print a deprecation warning urging to use .create_without_callbacks instead' do Model.should_receive(:warn).with(/Use create_without_callbacks instead/i) Model.should_receive(:create_without_callbacks).with('args') Model.new_and_store('args') end end end end
Version data entries
9 entries across 9 versions & 1 rubygems