Sha256: bfaf8f67fd4547e2f6ace409513739c7b3fdfb684cea84b9e2de8fd538ef6aae
Contents?: true
Size: 1.23 KB
Versions: 5
Compression:
Stored size: 1.23 KB
Contents
require 'spec_helper' describe Profile do it 'defaults to be a text-box' do i=Profile.new i.text_box?.should be_true end it 'can know if it belongs to a particular usage' do mocker=AMEEMocker.new self,:path=>'transport/car/generic' mocker.item_value_definitions. item_definition.data_category. item_value_definition('distance',['someusage'],['someotherusage']) t=CalculationSet.find("transport")[:transport].clone t[:distance].compulsory?('someusage').should eql true t[:distance].compulsory?('someotherusage').should eql false t[:distance].optional?('someotherusage').should eql true t[:distance].optional?('someusage').should eql false end it 'can have choices' do i=Profile.new{label :one; choices ['a','b']} i.choices.should eql ['a','b'] i.interface.should eql :drop_down end it 'must have a chosen choice if it has a choice' do i=Profile.new{label :one; choices ['a','b']} i.choices.should eql ['a','b'] i.value 'a' i.should be_valid i.value 'c' i.should_not be_valid end it 'doesn''t have to have choices' do i=Profile.new{label :one} i.choices.should be_nil i.interface.should eql :text_box i.value 'mark' i.should be_valid end end
Version data entries
5 entries across 5 versions & 1 rubygems