Sha256: 72cb76e5d03037dfddc011332e66c39d7908708962de654dacadf77d161fd948

Contents?: true

Size: 1.09 KB

Versions: 37

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

module Roqua
  module CoreApi
    module Models
      describe Person do
        let(:valid_person) { Person.new }

        describe '#new' do
          subject { Person.new firstname: 'first', lastname: 'last' }
          it 'accepts a hash of attributes' do
            expect(subject.firstname).to eq 'first'
          end
        end

        describe '#assign_attributes' do
          subject { Person.new firstname: 'first', lastname: 'last' }
          it 'accepts a hash of attributes' do
            subject.assign_attributes(firstname: 'new')
            expect(subject.firstname).to eq 'new'
          end
        end

        describe '#role' do
          it 'allows values: professional patient parent' do
            %w( professional patient parent ).each do |role|
              valid_person.role = role
              expect(valid_person.valid?).to be_truthy
            end
          end
          it 'does not allow other values' do
            valid_person.role = 'foobar'
            expect(valid_person.valid?).to be_falsy
          end
        end

      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
roqua-core-api-0.7.0 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.6.0 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.5.0 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.4.0 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.3.1 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.3.0 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.2.4 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.2.3 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.2.2 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.2.1 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.2.0 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.1.1 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.1.0 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.0.39 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.0.38 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.0.37 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.0.36 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.0.35 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.0.32 spec/lib/roqua/core_api/models/person_spec.rb
roqua-core-api-0.0.31 spec/lib/roqua/core_api/models/person_spec.rb