Module: ChainOptions
- Defined in:
- lib/chain_options/test_integration/rspec.rb,
lib/chain_options.rb,
lib/chain_options/util.rb,
lib/chain_options/option.rb,
lib/chain_options/builder.rb,
lib/chain_options/version.rb,
lib/chain_options/option_set.rb,
lib/chain_options/integration.rb
Overview
Custom matcher to test for chain option behaviour.
Every matcher call starts with ‘have_chain_option` which ensures the the given object actually has access to a chain option with the given name.
## Value Acceptance
To test for values which should raise an exception when being set as a chain option value, continue the matcher as follows:
it { is_expected.to have_chain_option(:my_option).which_takes(42).and_raises_an_exception }
## Value Filters / Transformations
To test whether the option is actually set to the correct value after passing an object to it, continue the matcher as follows:
it { is_expected.to have_chain_option(:my_option).which_takes(42).and_sets_it_as_value }
If you expect the option to perform a filtering and/or transformation, you can also specify the actual value you expect to be set:
it { is_expected.to have_chain_option(:my_option).which_takes(42).and_sets("42").as_value }
## Default Value
To test whether the option has a certain default value, continue the matcher as follows:
it { is_expected.to have_chain_option(:my_option).with_the_default_value(21) }
Defined Under Namespace
Modules: Integration, TestIntegration, Util Classes: Builder, Option, OptionSet
Constant Summary collapse
- VERSION =
'0.1.0'