README.md in unidom-authorization-1.6.4 vs README.md in unidom-authorization-1.6.5

- old
+ new

@@ -109,15 +109,66 @@ ## RSpec examples +### RSpec example manifest (run automatically) + ```ruby # spec/models/unidom_spec.rb require 'unidom/authorization/models_rspec' # spec/types/unidom_spec.rb require 'unidom/authorization/types_rspec' # spec/validators/unidom_spec.rb require 'unidom/authorization/validators_rspec' +``` + +### RSpec shared examples (to be integrated) + +```ruby +# lib/unidom.rb +def initialize_unidom + + Unidom::Party::Person.class_eval do + include Unidom::Authorization::Concerns::AsAuthorized + end + + Unidom::Position::Post.class_eval do + include Unidom::Authorization::Concerns::AsAuthorized + end + +end + +# spec/rails_helper.rb +require 'unidom' +initialize_unidom + +# spec/support/unidom_rspec_shared_examples.rb +require 'unidom/authorization/rspec_shared_examples' + +# spec/models/unidom/party/person_spec.rb +describe Unidom::Party::Person do + + model_attribtues = { + name: 'Tim' + } + + it_behaves_like 'Unidom::Authorization::Concerns::AsAuthorized', model_attribtues + +end + +# spec/models/unidom/position/post_spec.rb +describe Unidom::Position::Post do + + model_attribtues = { + name: 'HR Manager', + organization_id: SecureRandom.uuid, + organization_type: 'Unidom::Position::Organization::Mock', + position_id: SecureRandom.uuid + } + + it_behaves_like 'Unidom::Authorization::Concerns::AsAuthorized', model_attribtues + +end ```