Revert "DRY WorkPackageSchema#available_custom_fields spec"

This reverts commit 8e47f600b0.
pull/3194/head
Alex Coles 9 years ago
parent 8b4be7f749
commit 0436446257
  1. 10
      spec/lib/api/v3/work_packages/schema/work_package_schema_spec.rb

@ -99,20 +99,20 @@ describe ::API::V3::WorkPackages::Schema::WorkPackageSchema do
let(:cf2) { double }
let(:cf3) { double }
before do
allow_message_expectations_on_nil
it 'is expected to return custom fields available in project AND type' do
allow(type).to receive_message_chain(:custom_fields, :to_a).and_return([cf1, cf2])
allow(project).to receive_message_chain(:all_work_package_custom_fields, :to_a)
.and_return([cf2, cf3])
end
it 'is expected to return custom fields available in project AND type' do
expect(subject.available_custom_fields).to eql([cf2])
end
context 'type missing' do
let(:type) { nil }
it 'returns an empty list' do
allow(project).to receive_message_chain(:all_work_package_custom_fields, :to_a)
.and_return([cf2, cf3])
expect(subject.available_custom_fields).to eql([])
end
end
@ -120,6 +120,8 @@ describe ::API::V3::WorkPackages::Schema::WorkPackageSchema do
context 'project missing' do
let(:project) { nil }
it 'returns an empty list' do
allow(type).to receive_message_chain(:custom_fields, :to_a).and_return([cf1, cf2])
expect(subject.available_custom_fields).to eql([])
end
end

Loading…
Cancel
Save