OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/spec/support/contracts/shared.rb

26 lines
626 B

shared_context 'model contract' do
shared_examples_for 'is not writable' do
before do
instance.model.attributes = { attribute => value }
end
it 'explains the not writable error' do
instance.validate
expect(instance.errors.details[attribute])
.to match_array [{ error: :error_readonly }]
end
end
shared_examples_for 'is writable' do
before do
instance.model.attributes = { attribute => value }
end
it 'is writable' do
instance.validate
expect(instance.errors.details[attribute])
.not_to include(error: :error_readonly)
end
end
end