Tests for data type aliases should be placed under spec/type_aliases
. For
example, the tests for the MyModule::Shape
type alias would be placed in
spec/type_aliases/mymodule_shape_spec.rb
.
require 'spec_helper'
describe 'MyModule::Shape' do
# tests go here
end
The allow_value
matcher is used to test how the type alias behaves when given
a particular value.
it { is_expected.to allow_value('square') }
Multiple values can be provided in a single test using the allow_values
matcher
it { is_expected.to allow_values('circle', 'triangle') }
You can negate the allow_value
matcher to test expected failure cases.
it { is_expected.not_to allow_values('line', 'point') }