Adding pretty generic specs for attachment filters.

pull/6038/head
Wieland Lindenthal 7 years ago
parent a98198ec43
commit 5b58d77c05
  1. 62
      spec/models/queries/work_packages/filter/attachment_content_filter_spec.rb
  2. 62
      spec/models/queries/work_packages/filter/attachment_file_name_filter_spec.rb

@ -0,0 +1,62 @@
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2017 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
require 'spec_helper'
describe Queries::WorkPackages::Filter::AttachmentContentFilter, type: :model do
it_behaves_like 'basic query filter' do
let(:order) { 8 }
let(:type) { :text }
let(:class_key) { :attachment_content }
describe '#available?' do
it 'is available' do
expect(instance).to be_available
end
end
describe '#allowed_values' do
it 'is nil' do
expect(instance.allowed_values).to be_nil
end
end
describe '#valid_values!' do
it 'is a noop' do
instance.values = ['none', 'is', 'changed']
instance.valid_values!
expect(instance.values)
.to match_array ['none', 'is', 'changed']
end
end
it_behaves_like 'non ar filter'
end
end

@ -0,0 +1,62 @@
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2017 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
require 'spec_helper'
describe Queries::WorkPackages::Filter::AttachmentFileNameFilter, type: :model do
it_behaves_like 'basic query filter' do
let(:order) { 8 }
let(:type) { :text }
let(:class_key) { :attachment_file_name }
describe '#available?' do
it 'is available' do
expect(instance).to be_available
end
end
describe '#allowed_values' do
it 'is nil' do
expect(instance.allowed_values).to be_nil
end
end
describe '#valid_values!' do
it 'is a noop' do
instance.values = ['none', 'is', 'changed']
instance.valid_values!
expect(instance.values)
.to match_array ['none', 'is', 'changed']
end
end
it_behaves_like 'non ar filter'
end
end
Loading…
Cancel
Save