diff --git a/spec/models/query_spec.rb b/spec/models/query_spec.rb index a43c3c4eb2..7a9bd51201 100644 --- a/spec/models/query_spec.rb +++ b/spec/models/query_spec.rb @@ -73,18 +73,24 @@ describe Query do end context 'with a missing value for a custom field' do - let(:custom_field) {FactoryGirl.create :issue_custom_field} - let(:query2) { FactoryGirl.build(:query)} + let(:project) { FactoryGirl.create(:project_with_types) } + let(:type) {FactoryGirl.create(:type) } + let(:custom_field) do + FactoryGirl.create :issue_custom_field, + :name => "Verse", + :field_format => "text", + :projects => [project], + :types => [type] + end + let(:query) { FactoryGirl.build(:query)} before do query.add_filter("cf_" + custom_field.id.to_s,"=",[""]) end it 'should have the name of the custom field in the error message' do - require 'pry' - binding.pry - expect(query2.valid?).to be_false - expect(query2.errors.messages[:base].to_s).to include(custom_field.name) + expect(query.valid?).to be_false + expect(query.errors.messages[:base].to_s).to include(custom_field.name) end end end