Module: Cuprum::Rails::RSpec::Contracts::Actions::IndexContracts::ShouldFindTheEntitiesContract
- Extended by:
- RSpec::SleepingKingStudios::Contract
- Defined in:
- lib/cuprum/rails/rspec/contracts/actions/index_contracts.rb
Overview
Contract asserting the action queries the repository for the entities.
Instance Method Summary collapse
-
#apply(example_group, existing_entities: , **options) { ... } ⇒ Object
Adds the contract to the example group.
Instance Method Details
#apply(example_group, existing_entities: , **options) { ... } ⇒ Object
Adds the contract to the example group.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/cuprum/rails/rspec/contracts/actions/index_contracts.rb', line 71 contract do |existing_entities:, **, &block| include Cuprum::Rails::RSpec::Contracts::ActionContracts describe '#call' do include Cuprum::Rails::RSpec::ContractHelpers let(:request) do Cuprum::Rails::Request.new(params: configured_params) end let(:configured_params) do option_with_default([:params], default: {}) end let(:configured_existing_entities) do option_with_default(existing_entities) end let(:configured_expected_value) do resource_name = configured_resource.name option_with_default( [:expected_value], default: { resource_name => configured_existing_entities } ) end it 'should return a passing result' do expect(call_action) .to be_a_passing_result .with_value(configured_expected_value) end instance_exec(&block) if block end end |