Module: Cuprum::Rails::RSpec::Contracts::ActionContracts::ShouldBeAnActionContract
- Extended by:
- RSpec::SleepingKingStudios::Contract
- Defined in:
- lib/cuprum/rails/rspec/contracts/action_contracts.rb
Overview
Contract validating the interface for an action.
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.
27 28 29 30 31 32 33 34 35 36 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 |
# File 'lib/cuprum/rails/rspec/contracts/action_contracts.rb', line 27 contract do |**| describe '.new' do it { expect(described_class).to respond_to(:new).with(0).arguments } end describe '#call' do let(:expected_keywords) do %i[repository request] + .fetch(:required_keywords, []) end it 'should define the method' do expect(action) .to be_callable .with(0).arguments .and_keywords(*expected_keywords) .and_any_keywords end end describe '#options' do include_examples 'should define reader', :options end describe '#params' do include_examples 'should define reader', :params end describe '#repository' do include_examples 'should define reader', :repository end describe '#request' do include_examples 'should define reader', :request end end |