continue adapting to altered project properties

pull/7722/head
ulferts 5 years ago
parent 16ee49bf8a
commit 57131fa32b
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 2
      app/models/queries/projects.rb
  2. 2
      app/models/queries/projects/filters/created_at_filter.rb
  3. 2
      app/services/projects/archive_service.rb
  4. 2
      app/views/homescreen/blocks/_projects.html.erb
  5. 2
      app/views/homescreen/robots.text.erb
  6. 4
      app/views/projects/index.html.erb
  7. 2
      modules/auth_plugins/spec/features/auth_provider_spec.rb
  8. 2
      modules/backlogs/app/models/burndown.rb
  9. 2
      modules/backlogs/lib/open_project/backlogs/patches/project_patch.rb
  10. 2
      modules/backlogs/spec/models/burndown_spec.rb
  11. 95
      modules/reporting/spec/models/cost_query/operator_spec.rb
  12. 51
      spec/features/projects/projects_index_spec.rb
  13. 5
      spec/features/work_packages/select/select_query_spec.rb
  14. 2
      spec/features/work_packages/table/inline_create/parallel_creation_spec.rb
  15. 2
      spec/models/project_spec.rb
  16. 6
      spec/models/queries/projects/filters/created_at_filter_spec.rb
  17. 18
      spec/support/pages/projects/index.rb

@ -39,7 +39,7 @@ module Queries::Projects
register.filter query, filters::ActiveFilter register.filter query, filters::ActiveFilter
register.filter query, filters::NameAndIdentifierFilter register.filter query, filters::NameAndIdentifierFilter
register.filter query, filters::CustomFieldFilter register.filter query, filters::CustomFieldFilter
register.filter query, filters::CreatedOnFilter register.filter query, filters::CreatedAtFilter
register.filter query, filters::LatestActivityAtFilter register.filter query, filters::LatestActivityAtFilter
register.filter query, filters::PrincipalFilter register.filter query, filters::PrincipalFilter
register.filter query, filters::ParentFilter register.filter query, filters::ParentFilter

@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details. # See docs/COPYRIGHT.rdoc for more details.
#++ #++
class Queries::Projects::Filters::CreatedOnFilter < Queries::Projects::Filters::ProjectFilter class Queries::Projects::Filters::CreatedAtFilter < Queries::Projects::Filters::ProjectFilter
def type def type
:datetime_past :datetime_past
end end

@ -51,7 +51,7 @@ module Projects
def archive_project(project) def archive_project(project)
# we do not care for validations # we do not care for validations
project.update_column(:active, true) project.update_column(:active, false)
end end
end end
end end

@ -10,7 +10,7 @@
<% @newest_projects.each do |project| %> <% @newest_projects.each do |project| %>
<li> <li>
<%= link_to project, project_path(project), title: short_project_description(project) %> <%= link_to project, project_path(project), title: short_project_description(project) %>
<small>(<%= format_date(project.created_on) %>)</small> <small>(<%= format_date(project.created_at) %>)</small>
</li> </li>
<% end %> <% end %>
</ul> </ul>

@ -27,7 +27,7 @@ See docs/COPYRIGHT.rdoc for more details.
++#%> ++#%>
User-agent: * User-agent: *
<% cache @projects.cache_key(:updated_on) do %> <% cache @projects.cache_key(:updated_at) do %>
<% @projects.each do |p| -%> <% @projects.each do |p| -%>
Disallow: <%= project_repository_path(p) %> Disallow: <%= project_repository_path(p) %>
Disallow: <%= project_work_packages_path(p) %> Disallow: <%= project_work_packages_path(p) %>

@ -73,7 +73,7 @@ See docs/COPYRIGHT.rdoc for more details.
<% end %> <% end %>
<% if User.current.admin? %> <% if User.current.admin? %>
<%= projects_sort_header_tag('required_disk_space', caption: I18n.t(:label_required_disk_storage), param: :json) %> <%= projects_sort_header_tag('required_disk_space', caption: I18n.t(:label_required_disk_storage), param: :json) %>
<%= projects_sort_header_tag('created_on', caption: Project.human_attribute_name(:created_on), param: :json) %> <%= projects_sort_header_tag('created_at', caption: Project.human_attribute_name(:created_at), param: :json) %>
<%= projects_sort_header_tag('latest_activity_at', caption: Project.human_attribute_name(:latest_activity_at), param: :json) %> <%= projects_sort_header_tag('latest_activity_at', caption: Project.human_attribute_name(:latest_activity_at), param: :json) %>
<% end %> <% end %>
<th class="-right"> <th class="-right">
@ -116,7 +116,7 @@ See docs/COPYRIGHT.rdoc for more details.
<% end %> <% end %>
<% if User.current.admin? %> <% if User.current.admin? %>
<td><%= number_to_human_size(project.required_disk_space, precision: 2) if project.required_disk_space.to_i > 0 %></td> <td><%= number_to_human_size(project.required_disk_space, precision: 2) if project.required_disk_space.to_i > 0 %></td>
<td><%= format_date(project.created_on) %></td> <td><%= format_date(project.created_at) %></td>
<td><%= format_date(project.latest_activity_at) %></td> <td><%= format_date(project.latest_activity_at) %></td>
<% end %> <% end %>
<td class="buttons"> <td class="buttons">

@ -40,7 +40,7 @@ describe 'rendering the login buttons', js: true do
end end
describe 'in a public project', with_settings: { login_required: false } do describe 'in a public project', with_settings: { login_required: false } do
let(:public_project) { FactoryBot.build(:project, is_public: true) } let(:public_project) { FactoryBot.build(:project, public: true) }
it 'renders correctly' do it 'renders correctly' do
visit project_path(public_project) visit project_path(public_project)

@ -35,8 +35,6 @@
class Burndown class Burndown
def initialize(sprint, project, burn_direction = nil) def initialize(sprint, project, burn_direction = nil)
burn_direction ||= Setting.plugin_openproject_backlogs['points_burn_direction']
@sprint_id = sprint.id @sprint_id = sprint.id
make_date_series sprint make_date_series sprint

@ -38,7 +38,7 @@ require_dependency 'project'
module OpenProject::Backlogs::Patches::ProjectPatch module OpenProject::Backlogs::Patches::ProjectPatch
def self.included(base) def self.included(base)
base.class_eval do base.class_eval do
has_and_belongs_to_many :done_statuses, join_table: :done_statuses_for_project, class_name: 'Status' has_and_belongs_to_many :done_statuses, join_table: :done_statuses_for_project, class_name: '::Status'
include InstanceMethods include InstanceMethods
end end

@ -40,7 +40,7 @@ describe Burndown, type: :model do
story.reload story.reload
story.send(attribute, value) story.send(attribute, value)
story.save! story.save!
story.current_journal.update_attribute(:created_at, day) story.current_journal.update(created_at: day)
end end
let(:user) { @user ||= FactoryBot.create(:user) } let(:user) { @user ||= FactoryBot.create(:user) }

@ -22,8 +22,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe CostQuery, type: :model, reporting_query_helper: true do describe CostQuery, type: :model, reporting_query_helper: true do
minimal_query minimal_query
let!(:project1) { FactoryBot.create(:project, name: "project1", created_on: 5.minutes.ago) } let!(:project1) { FactoryBot.create(:project, name: "project1", created_at: 5.minutes.ago) }
let!(:project2) { FactoryBot.create(:project, name: "project2", created_on: 6.minutes.ago) } let!(:project2) { FactoryBot.create(:project, name: "project2", created_at: 6.minutes.ago) }
describe CostQuery::Operator do describe CostQuery::Operator do
def query(table, field, operator, *values) def query(table, field, operator, *values)
@ -110,69 +110,69 @@ describe CostQuery, type: :model, reporting_query_helper: true do
it "does w (this week)" do it "does w (this week)" do
#somehow this test doesn't work on sundays #somehow this test doesn't work on sundays
n = query('projects', 'created_on', 'w').size n = query('projects', 'created_at', 'w').size
day_in_this_week = Time.now.at_beginning_of_week + 1.day day_in_this_week = Time.now.at_beginning_of_week + 1.day
FactoryBot.create(:project, created_on: day_in_this_week) FactoryBot.create(:project, created_at: day_in_this_week)
expect(query('projects', 'created_on', 'w').size).to eq(n + 1) expect(query('projects', 'created_at', 'w').size).to eq(n + 1)
FactoryBot.create(:project, created_on: day_in_this_week + 7.days) FactoryBot.create(:project, created_at: day_in_this_week + 7.days)
FactoryBot.create(:project, created_on: day_in_this_week - 7.days) FactoryBot.create(:project, created_at: day_in_this_week - 7.days)
expect(query('projects', 'created_on', 'w').size).to eq(n + 1) expect(query('projects', 'created_at', 'w').size).to eq(n + 1)
end end
it "does t (today)" do it "does t (today)" do
s = query('projects', 'created_on', 't').size s = query('projects', 'created_at', 't').size
FactoryBot.create(:project, created_on: Date.yesterday) FactoryBot.create(:project, created_at: Date.yesterday)
expect(query('projects', 'created_on', 't').size).to eq(s) expect(query('projects', 'created_at', 't').size).to eq(s)
FactoryBot.create(:project, created_on: Time.now) FactoryBot.create(:project, created_at: Time.now)
expect(query('projects', 'created_on', 't').size).to eq(s + 1) expect(query('projects', 'created_at', 't').size).to eq(s + 1)
end end
it "does <t+ (before the day which is n days in the future)" do it "does <t+ (before the day which is n days in the future)" do
n = query('projects', 'created_on', '<t+', 2).size n = query('projects', 'created_at', '<t+', 2).size
FactoryBot.create(:project, created_on: Date.tomorrow + 1) FactoryBot.create(:project, created_at: Date.tomorrow + 1)
expect(query('projects', 'created_on', '<t+', 2).size).to eq(n + 1) expect(query('projects', 'created_at', '<t+', 2).size).to eq(n + 1)
FactoryBot.create(:project, created_on: Date.tomorrow + 2) FactoryBot.create(:project, created_at: Date.tomorrow + 2)
expect(query('projects', 'created_on', '<t+', 2).size).to eq(n + 1) expect(query('projects', 'created_at', '<t+', 2).size).to eq(n + 1)
end end
it "does t+ (n days in the future)" do it "does t+ (n days in the future)" do
n = query('projects', 'created_on', 't+', 1).size n = query('projects', 'created_at', 't+', 1).size
FactoryBot.create(:project, created_on: Date.tomorrow) FactoryBot.create(:project, created_at: Date.tomorrow)
expect(query('projects', 'created_on', 't+', 1).size).to eq(n + 1) expect(query('projects', 'created_at', 't+', 1).size).to eq(n + 1)
FactoryBot.create(:project, created_on: Date.tomorrow + 2) FactoryBot.create(:project, created_at: Date.tomorrow + 2)
expect(query('projects', 'created_on', 't+', 1).size).to eq(n + 1) expect(query('projects', 'created_at', 't+', 1).size).to eq(n + 1)
end end
it "does >t+ (after the day which is n days in the furure)" do it "does >t+ (after the day which is n days in the furure)" do
n = query('projects', 'created_on', '>t+', 1).size n = query('projects', 'created_at', '>t+', 1).size
FactoryBot.create(:project, created_on: Time.now) FactoryBot.create(:project, created_at: Time.now)
expect(query('projects', 'created_on', '>t+', 1).size).to eq(n) expect(query('projects', 'created_at', '>t+', 1).size).to eq(n)
FactoryBot.create(:project, created_on: Date.tomorrow + 1) FactoryBot.create(:project, created_at: Date.tomorrow + 1)
expect(query('projects', 'created_on', '>t+', 1).size).to eq(n + 1) expect(query('projects', 'created_at', '>t+', 1).size).to eq(n + 1)
end end
it "does >t- (after the day which is n days ago)" do it "does >t- (after the day which is n days ago)" do
n = query('projects', 'created_on', '>t-', 1).size n = query('projects', 'created_at', '>t-', 1).size
FactoryBot.create(:project, created_on: Date.today) FactoryBot.create(:project, created_at: Date.today)
expect(query('projects', 'created_on', '>t-', 1).size).to eq(n + 1) expect(query('projects', 'created_at', '>t-', 1).size).to eq(n + 1)
FactoryBot.create(:project, created_on: Date.yesterday - 1) FactoryBot.create(:project, created_at: Date.yesterday - 1)
expect(query('projects', 'created_on', '>t-', 1).size).to eq(n + 1) expect(query('projects', 'created_at', '>t-', 1).size).to eq(n + 1)
end end
it "does t- (n days ago)" do it "does t- (n days ago)" do
n = query('projects', 'created_on', 't-', 1).size n = query('projects', 'created_at', 't-', 1).size
FactoryBot.create(:project, created_on: Date.yesterday) FactoryBot.create(:project, created_at: Date.yesterday)
expect(query('projects', 'created_on', 't-', 1).size).to eq(n + 1) expect(query('projects', 'created_at', 't-', 1).size).to eq(n + 1)
FactoryBot.create(:project, created_on: Date.yesterday - 2) FactoryBot.create(:project, created_at: Date.yesterday - 2)
expect(query('projects', 'created_on', 't-', 1).size).to eq(n + 1) expect(query('projects', 'created_at', 't-', 1).size).to eq(n + 1)
end end
it "does <t- (before the day which is n days ago)" do it "does <t- (before the day which is n days ago)" do
n = query('projects', 'created_on', '<t-', 1).size n = query('projects', 'created_at', '<t-', 1).size
FactoryBot.create(:project, created_on: Date.today) FactoryBot.create(:project, created_at: Date.today)
expect(query('projects', 'created_on', '<t-', 1).size).to eq(n) expect(query('projects', 'created_at', '<t-', 1).size).to eq(n)
FactoryBot.create(:project, created_on: Date.yesterday - 1) FactoryBot.create(:project, created_at: Date.yesterday - 1)
expect(query('projects', 'created_on', '<t-', 1).size).to eq(n + 1) expect(query('projects', 'created_at', '<t-', 1).size).to eq(n + 1)
end end
#Our own operators #Our own operators
@ -240,20 +240,20 @@ describe CostQuery, type: :model, reporting_query_helper: true do
it "does =d" do it "does =d" do
#assuming that there aren't more than one project created at the same time #assuming that there aren't more than one project created at the same time
expect(query('projects', 'created_on', '=d', Project.order(Arel.sql('id ASC')).first.created_on).size).to eq(1) expect(query('projects', 'created_at', '=d', Project.order(Arel.sql('id ASC')).first.created_at).size).to eq(1)
end end
it "does <d" do it "does <d" do
expect(query('projects', 'created_on', '<d', Time.now).size).to eq(Project.count) expect(query('projects', 'created_at', '<d', Time.now).size).to eq(Project.count)
end end
it "does <>d" do it "does <>d" do
expect(query('projects', 'created_on', '<>d', Time.now, 5.minutes.from_now).size).to eq(0) expect(query('projects', 'created_at', '<>d', Time.now, 5.minutes.from_now).size).to eq(0)
end end
it "does >d" do it "does >d" do
#assuming that all projects were created in the past #assuming that all projects were created in the past
expect(query('projects', 'created_on', '>d', Time.now).size).to eq(0) expect(query('projects', 'created_at', '>d', Time.now).size).to eq(0)
end end
describe 'arity' do describe 'arity' do
@ -262,6 +262,5 @@ describe CostQuery, type: :model, reporting_query_helper: true do
it("#{o} should take #{a} values") { expect(o.to_operator.arity).to eq(a) } it("#{o} should take #{a} values") { expect(o.to_operator.arity).to eq(a) }
end end
end end
end end
end end

@ -121,7 +121,7 @@ describe 'Projects index page',
feature 'for admins' do feature 'for admins' do
before do before do
project.update(created_on: 7.days.ago) project.update(created_at: 7.days.ago)
news news
end end
@ -152,7 +152,7 @@ describe 'Projects index page',
expect(page) expect(page)
.to have_selector('th', text: 'CREATED ON') .to have_selector('th', text: 'CREATED ON')
expect(page) expect(page)
.to have_selector('td', text: project.created_on.strftime('%m/%d/%Y')) .to have_selector('td', text: project.created_at.strftime('%m/%d/%Y'))
expect(page) expect(page)
.to have_selector('th', text: 'LATEST ACTIVITY AT') .to have_selector('th', text: 'LATEST ACTIVITY AT')
expect(page) expect(page)
@ -315,12 +315,11 @@ describe 'Projects index page',
load_and_open_filters admin load_and_open_filters admin
# value selection defaults to "active"' # value selection defaults to "active"'
expect(page).to have_selector('li[filter-name="status"]') expect(page).to have_selector('li[filter-name="active"]')
# Filter has three operators 'all', 'active' and 'archived' # Filter has three operators 'all', 'active' and 'archived'
expect(page.find('li[filter-name="status"] select[name="operator"] option[value="*"]')).to have_text('all') expect(page.find('li[filter-name="active"] select[name="operator"] option[value="="]')).to have_text('is')
expect(page.find('li[filter-name="status"] select[name="operator"] option[value="="]')).to have_text('is') expect(page.find('li[filter-name="active"] select[name="operator"] option[value="!"]')).to have_text('is not')
expect(page.find('li[filter-name="status"] select[name="operator"] option[value="!"]')).to have_text('is not')
expect(page).to have_text(parent_project.name) expect(page).to have_text(parent_project.name)
expect(page).to have_text(child_project.name) expect(page).to have_text(child_project.name)
@ -347,7 +346,7 @@ describe 'Projects index page',
load_and_open_filters admin load_and_open_filters admin
projects_page.filter_by_status('archived') projects_page.filter_by_active('no')
expect(page).to have_text("ARCHIVED #{parent_project.name}") expect(page).to have_text("ARCHIVED #{parent_project.name}")
expect(page).to have_text("ARCHIVED #{child_project.name}") expect(page).to have_text("ARCHIVED #{child_project.name}")
@ -373,7 +372,7 @@ describe 'Projects index page',
load_and_open_filters admin load_and_open_filters admin
projects_page.filter_by_status('active') projects_page.filter_by_active('yes')
expect(page).to have_text(parent_project.name) expect(page).to have_text(parent_project.name)
expect(page).to have_no_text(child_project.name) expect(page).to have_no_text(child_project.name)
@ -397,7 +396,7 @@ describe 'Projects index page',
let!(:project_created_on_today) do let!(:project_created_on_today) do
project = FactoryBot.create(:project, project = FactoryBot.create(:project,
name: 'Created today project', name: 'Created today project',
created_on: DateTime.now) created_at: DateTime.now)
project.custom_field_values = { list_custom_field.id => list_custom_field.possible_values[2], project.custom_field_values = { list_custom_field.id => list_custom_field.possible_values[2],
date_custom_field.id => '2011-11-11' } date_custom_field.id => '2011-11-11' }
project.save! project.save!
@ -406,17 +405,17 @@ describe 'Projects index page',
let!(:project_created_on_this_week) do let!(:project_created_on_this_week) do
FactoryBot.create(:project, FactoryBot.create(:project,
name: 'Created on this week project', name: 'Created on this week project',
created_on: datetime_of_this_week) created_at: datetime_of_this_week)
end end
let!(:project_created_on_six_days_ago) do let!(:project_created_on_six_days_ago) do
FactoryBot.create(:project, FactoryBot.create(:project,
name: 'Created on six days ago project', name: 'Created on six days ago project',
created_on: DateTime.now - 6.days) created_at: DateTime.now - 6.days)
end end
let!(:project_created_on_fixed_date) do let!(:project_created_on_fixed_date) do
FactoryBot.create(:project, FactoryBot.create(:project,
name: 'Created on fixed date project', name: 'Created on fixed date project',
created_on: fixed_datetime) created_at: fixed_datetime)
end end
let!(:todays_wp) do let!(:todays_wp) do
# This WP should trigger a change to the project's 'latest activity at' DateTime # This WP should trigger a change to the project's 'latest activity at' DateTime
@ -433,7 +432,7 @@ describe 'Projects index page',
scenario 'selecting operator' do scenario 'selecting operator' do
# created on 'today' shows projects that were created today # created on 'today' shows projects that were created today
projects_page.set_filter('created_on', projects_page.set_filter('created_at',
'Created on', 'Created on',
'today') 'today')
@ -444,9 +443,9 @@ describe 'Projects index page',
expect(page).to_not have_text(project_created_on_fixed_date.name) expect(page).to_not have_text(project_created_on_fixed_date.name)
# created on 'this week' shows projects that were created within the last seven days # created on 'this week' shows projects that were created within the last seven days
remove_filter('created_on') remove_filter('created_at')
projects_page.set_filter('created_on', projects_page.set_filter('created_at',
'Created on', 'Created on',
'this week') 'this week')
@ -457,9 +456,9 @@ describe 'Projects index page',
expect(page).to_not have_text(project_created_on_fixed_date.name) expect(page).to_not have_text(project_created_on_fixed_date.name)
# created on 'on' shows projects that were created within the last seven days # created on 'on' shows projects that were created within the last seven days
remove_filter('created_on') remove_filter('created_at')
projects_page.set_filter('created_on', projects_page.set_filter('created_at',
'Created on', 'Created on',
'on', 'on',
['2017-11-11']) ['2017-11-11'])
@ -471,9 +470,9 @@ describe 'Projects index page',
expect(page).to_not have_text(project_created_on_this_week.name) expect(page).to_not have_text(project_created_on_this_week.name)
# created on 'less than days ago' # created on 'less than days ago'
remove_filter('created_on') remove_filter('created_at')
projects_page.set_filter('created_on', projects_page.set_filter('created_at',
'Created on', 'Created on',
'less than days ago', 'less than days ago',
['1']) ['1'])
@ -484,9 +483,9 @@ describe 'Projects index page',
expect(page).to_not have_text(project_created_on_fixed_date.name) expect(page).to_not have_text(project_created_on_fixed_date.name)
# created on 'more than days ago' # created on 'more than days ago'
remove_filter('created_on') remove_filter('created_at')
projects_page.set_filter('created_on', projects_page.set_filter('created_at',
'Created on', 'Created on',
'more than days ago', 'more than days ago',
['1']) ['1'])
@ -497,9 +496,9 @@ describe 'Projects index page',
expect(page).to_not have_text(project_created_on_today.name) expect(page).to_not have_text(project_created_on_today.name)
# created on 'between' # created on 'between'
remove_filter('created_on') remove_filter('created_at')
projects_page.set_filter('created_on', projects_page.set_filter('created_at',
'Created on', 'Created on',
'between', 'between',
['2017-11-10', '2017-11-12']) ['2017-11-10', '2017-11-12'])
@ -510,7 +509,7 @@ describe 'Projects index page',
expect(page).to_not have_text(project_created_on_today.name) expect(page).to_not have_text(project_created_on_today.name)
# Latest activity at 'today'. This spot check would fail if the data does not get collected from multiple tables # Latest activity at 'today'. This spot check would fail if the data does not get collected from multiple tables
remove_filter('created_on') remove_filter('created_at')
projects_page.set_filter('latest_activity_at', projects_page.set_filter('latest_activity_at',
'Latest activity at', 'Latest activity at',
@ -631,7 +630,7 @@ describe 'Projects index page',
# Remove public projects from the default list for these scenarios. # Remove public projects from the default list for these scenarios.
public_project.update(active: false) public_project.update(active: false)
project.update(created_on: 7.days.ago) project.update(created_at: 7.days.ago)
news news
end end
@ -692,7 +691,7 @@ describe 'Projects index page',
expect(page) expect(page)
.to have_no_selector('th', text: 'CREATED ON') .to have_no_selector('th', text: 'CREATED ON')
expect(page) expect(page)
.to have_no_selector('td', text: project.created_on.strftime('%m/%d/%Y')) .to have_no_selector('td', text: project.created_at.strftime('%m/%d/%Y'))
expect(page) expect(page)
.to have_no_selector('th', text: 'LATEST ACTIVITY AT') .to have_no_selector('th', text: 'LATEST ACTIVITY AT')
expect(page) expect(page)

@ -41,9 +41,8 @@ describe 'Query selection', type: :feature do
let(:wp_page) { ::Pages::WorkPackagesTable.new project } let(:wp_page) { ::Pages::WorkPackagesTable.new project }
let(:filters) { ::Components::WorkPackages::Filters.new } let(:filters) { ::Components::WorkPackages::Filters.new }
let(:query) do let(:query) do
FactoryBot.build(:query, project: project, public: true).tap do |query| FactoryBot.build(:query, project: project, is_public: true).tap do |query|
query.filters.clear query.filters.clear
query.add_filter('assigned_to_id', '=', ['me']) query.add_filter('assigned_to_id', '=', ['me'])
query.add_filter('done_ratio', '>=', [10]) query.add_filter('done_ratio', '>=', [10])
@ -91,7 +90,7 @@ describe 'Query selection', type: :feature do
context 'when the selected query is changed' do context 'when the selected query is changed' do
let(:query2) do let(:query2) do
FactoryBot.create(:query, project: project, public: true) FactoryBot.create(:query, project: project, is_public: true)
end end
before do before do

@ -20,7 +20,7 @@ describe 'Parallel work package creation spec', js: true do
end end
let!(:project) { FactoryBot.create(:project, public: true) } let!(:project) { FactoryBot.create(:project, public: true) }
let!(:priority) { FactoryBot.create :priority, default: true } let!(:priority) { FactoryBot.create :priority, is_default: true }
let(:wp_table) { ::Pages::WorkPackagesTable.new(project) } let(:wp_table) { ::Pages::WorkPackagesTable.new(project) }
before do before do

@ -182,7 +182,7 @@ describe Project, type: :model do
end end
it 'is destroyed along with the project' do it 'is destroyed along with the project' do
status = project.create_status description: 'some description' status = project.create_status explanation: 'some description'
project.destroy! project.destroy!

@ -30,12 +30,12 @@
require 'spec_helper' require 'spec_helper'
describe Queries::Projects::Filters::CreatedOnFilter, type: :model do describe Queries::Projects::Filters::CreatedAtFilter, type: :model do
it_behaves_like 'basic query filter' do it_behaves_like 'basic query filter' do
let(:class_key) { :created_on } let(:class_key) { :created_at }
let(:type) { :datetime_past } let(:type) { :datetime_past }
let(:model) { Project } let(:model) { Project }
let(:attribute) { :created_on } let(:attribute) { :created_at }
let(:values) { ['3'] } let(:values) { ['3'] }
let(:admin) { FactoryBot.build_stubbed(:admin) } let(:admin) { FactoryBot.build_stubbed(:admin) }
let(:user) { FactoryBot.build_stubbed(:user) } let(:user) { FactoryBot.build_stubbed(:user) }

@ -40,9 +40,9 @@ module Pages
expect(rows.map(&:text)).to eq(users.map(&:login)) expect(rows.map(&:text)).to eq(users.map(&:login))
end end
def filter_by_status(value) def filter_by_active(value)
set_filter('status', set_filter('active',
'Active or archived', 'Active',
'is', 'is',
[value]) [value])
@ -61,17 +61,17 @@ module Pages
case name case name
when 'name_and_identifier' when 'name_and_identifier'
set_name_and_identifier_filter(values) set_name_and_identifier_filter(values)
when 'status' when 'active'
set_status_filter(values) set_active_filter(values)
when 'created_on' when 'created_at'
set_created_on_filter(human_operator, values) set_created_at_filter(human_operator, values)
when /cf_[\d]+/ when /cf_[\d]+/
set_custom_field_filter(selected_filter, human_operator, values) set_custom_field_filter(selected_filter, human_operator, values)
end end
end end
end end
def set_status_filter(values) def set_active_filter(values)
if values.size == 1 if values.size == 1
select values.first, from: 'value' select values.first, from: 'value'
end end
@ -81,7 +81,7 @@ module Pages
fill_in 'value', with: values.first fill_in 'value', with: values.first
end end
def set_created_on_filter(human_operator, values) def set_created_at_filter(human_operator, values)
case human_operator case human_operator
when 'on', 'less than days ago', 'more than days ago', 'days ago' when 'on', 'less than days ago', 'more than days ago', 'days ago'
fill_in 'value', with: values.first fill_in 'value', with: values.first

Loading…
Cancel
Save