Sha256: 6bcd70ce7ecef2d4ee64bd8402d1e7b38a01c26d654eafda837c78a8a10e06e8

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

require File.dirname(File.dirname(__FILE__)) + '/spec_helper.rb'

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=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

6 entries across 6 versions & 1 rubygems

Version Path
amee-data-abstraction-2.1.1 spec/amee-data-abstraction/profile_spec.rb
amee-data-abstraction-2.1.0 spec/amee-data-abstraction/profile_spec.rb
amee-data-abstraction-1.2.0 spec/amee-data-abstraction/profile_spec.rb
amee-data-abstraction-2.0.0 spec/amee-data-abstraction/profile_spec.rb
amee-data-abstraction-1.1.0 spec/amee-data-abstraction/profile_spec.rb
amee-data-abstraction-1.0.0 spec/amee-data-abstraction/profile_spec.rb