Test WP custom fields visible for all are handled

pull/1455/head
Hagen Schink 11 years ago
parent 8d2b0608a8
commit b2da7d3878
  1. 11
      spec/controllers/api/v2/custom_fields_controller_spec.rb

@ -34,6 +34,7 @@ describe Api::V2::CustomFieldsController do
let!(:wp_custom_field_1) { FactoryGirl.create(:work_package_custom_field) }
let!(:wp_custom_field_2) { FactoryGirl.create(:work_package_custom_field) }
let!(:wp_custom_field_3) { FactoryGirl.create(:work_package_custom_field) }
let!(:wp_custom_field_for_all) { FactoryGirl.create(:work_package_custom_field, is_for_all: true) }
let(:wp_custom_fields) { [wp_custom_field_1, wp_custom_field_2] }
let(:project) { FactoryGirl.create(:project, work_package_custom_fields: wp_custom_fields) }
@ -60,9 +61,11 @@ describe Api::V2::CustomFieldsController do
subject { assigns(:custom_fields) }
it { expect(subject.count).to eq(1) }
it { expect(subject.count).to eq(2) }
it { expect(subject).to include(custom_field) }
it { expect(subject).to include(wp_custom_field_for_all) }
end
end
@ -79,12 +82,14 @@ describe Api::V2::CustomFieldsController do
subject { assigns(:custom_fields) }
it { expect(subject.count).to eq(3) }
it { expect(subject.count).to eq(4) }
it { expect(subject).to include(wp_custom_field_1) }
it { expect(subject).to include(wp_custom_field_2) }
it { expect(subject).to include(wp_custom_field_for_all) }
it { expect(subject).to include(custom_field) }
it { expect(subject).not_to include(wp_custom_field_3) }
@ -103,7 +108,7 @@ describe Api::V2::CustomFieldsController do
subject { assigns(:custom_fields) }
it { expect(subject.count).to eq(4) }
it { expect(subject.count).to eq(5) }
end
end
end

Loading…
Cancel
Save