Sha256: 1a6dce6c9f38d75d4809cdac550fb17987580ff6e45b2e30a1dd1aa5236c2275
Contents?: true
Size: 1.73 KB
Versions: 1
Compression:
Stored size: 1.73 KB
Contents
# frozen_string_literal: true # Load the class under test require_relative '../../../lib/zenlish/inflect/feature_heading' module Zenlish module Inflect describe FeatureHeading do let(:feature_name) { 'NUMBER' } subject { FeatureHeading.new(feature_name) } context 'Initialization:' do it 'should be initialized with a feature name' do expect { FeatureHeading.new(feature_name) }.not_to raise_error end it 'should know its label' do expect(subject.label).to eq(feature_name) end end # context context 'Provided services:' do let(:a_domain) { Feature::EnumerationDomain.new(:singular, :plural) } let(:enum_def) { Feature::FeatureDef.new(feature_name, a_domain) } let(:b_domain) { Feature::BooleanDomain.instance } let(:bool_def) { Feature::FeatureDef.new(feature_name, b_domain) } it 'should obtain the value of a feature' do mocked = { 'NUMBER' => :plural } expect(subject.evaluate_for(mocked)).to eq(:plural) end it 'should obtain all possible values of a feature' do mocked = { 'NUMBER' => :plural } expect(subject.all_matches(mocked)).to eq([:plural]) end it 'should obtain all possible values of a enumeration domain' do mocked = { 'NUMBER' => enum_def } expect(subject.all_matches(mocked)).to eq([:singular, :plural]) end it 'should obtain all possible values of a enumeration domain' do mocked = { 'NUMBER' => bool_def } expect(subject.all_matches(mocked)).to eq([false, true]) end end # context end # describe end # module end # module
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zenlish-0.2.05 | spec/zenlish/inflect/feature_heading_spec.rb |