Module: Cuprum::Rails::RSpec::Contracts::Actions::EditContracts::ShouldBeAnEditActionContract
- Extended by:
- RSpec::SleepingKingStudios::Contract
- Defined in:
- lib/cuprum/rails/rspec/contracts/actions/edit_contracts.rb
Overview
Contract asserting the action implements the edit action interface.
Instance Method Summary collapse
-
#apply(example_group, existing_entity: , **options) { ... } ⇒ Object
Adds the contract to the example group.
Instance Method Details
#apply(example_group, existing_entity: , **options) { ... } ⇒ Object
Adds the contract to the example group.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/cuprum/rails/rspec/contracts/actions/edit_contracts.rb', line 37 contract do |existing_entity:, **, &block| include Cuprum::Rails::RSpec::Contracts::ActionContracts # :nocov: if [:examples_on_success] && block raise ArgumentError, 'provide either :examples_on_success or a block' elsif block [:examples_on_success] = block end # :nocov: include_contract 'should be a resource action' include_contract( 'should require primary key', params: [:params], &[:examples_on_failure] ) include_contract( 'should require existing entity', params: [:params], primary_key_value: [:primary_key_value], &[:examples_on_failure] ) include_contract( 'should find the entity', existing_entity: existing_entity, expected_value: [:expected_value_on_success], params: [:params], &[:examples_on_success] ) end |