Module: Cuprum::Rails::RSpec::Contracts::Actions::NewContracts::ShouldBuildTheEntityContract
- Extended by:
- RSpec::SleepingKingStudios::Contract
- Defined in:
- lib/cuprum/rails/rspec/contracts/actions/new_contracts.rb
Overview
Contract asserting the action builds a new entity.
Instance Method Summary collapse
-
#apply(example_group, **options) { ... } ⇒ Object
Adds the contract to the example group.
Instance Method Details
#apply(example_group, **options) { ... } ⇒ Object
Adds the contract to the example group.
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 106 107 108 |
# File 'lib/cuprum/rails/rspec/contracts/actions/new_contracts.rb', line 73 contract do |**, &block| 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_expected_attributes) do option_with_default([:expected_attributes], default: {}) end let(:configured_expected_entity) do configured_resource .entity_class .new(configured_expected_attributes) end let(:configured_expected_value) do resource_name = configured_resource.singular_name option_with_default( [:expected_value], default: { resource_name => configured_expected_entity } ) 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 |