README.md in active_mocker-2.4.0.pre5 vs README.md in active_mocker-2.4.0

- old
+ new

@@ -194,18 +194,43 @@ Use theses defaults if you are starting fresh ```ruby ActiveMocker::LoadedMocks.features.enable(:timestamps) ActiveMocker::LoadedMocks.features.enable(:delete_all_before_example) +ActiveMocker::LoadedMocks.features.enable(:stub_active_record_exceptions) ``` ### timestamps -Enables created_at and updated_at to be update on save and create + Enables created_at and updated_at to be update on save and create + ### delete_all_before_example -When using "active_mocker/rspec_helper" it delete all records from all mocks before each example. + When using "active_mocker/rspec_helper" it delete all records from all mocks before each example. + +### stub_active_record_exceptions + + When requiring "active_mocker/rspec_helper", and adding `active_mocker: true` to the describe metadata, these errors will be auto stubbed: + + * ActiveRecord::RecordNotFound + * ActiveRecord::RecordNotUnique + * ActiveRecord::UnknownAttributeError + +### Copy over Mock safe methods into the generated mock + + Adding the comment `ActiveMocker.safe_methods` at the top of a class marks it as safe to copy to the mock. + Be careful that it does not contain anything that ActiveMocker cannot run. + + ```ruby + # ActiveMocker.safe_methods :full_name + class User + def full_name + "#{first_name} + #{last_name} + end + end + ``` + ## Mocking Methods #### Rspec 3 Mocks - verify double Verifying doubles are a stricter alternative to normal doubles that provide guarantees about what is being verified. When using verifying doubles, RSpec will check that the methods @@ -380,10 +405,9 @@ * build_< association > * create_< association > * create_< association >! * < association >.create * < association >.build - ### Schema/Migration Option Support * A db/schema.rb is not required. * All schema types are supported and coerced by [Virtus](https://github.com/solnic/virtus). If coercion fails the passed value will be retained. * Default value is supported.