Refactor: rename factory week_days

pull/11205/head
Christophe Bliard 2 years ago
parent 3824f59cc8
commit 4e2dd77892
No known key found for this signature in database
GPG Key ID: 2BC07603210C3FA4
  1. 2
      modules/calendar/spec/features/calendar_dates_spec.rb
  2. 2
      modules/team_planner/spec/features/team_planner_dates_spec.rb
  3. 6
      spec/contracts/work_packages/base_contract_spec.rb
  4. 2
      spec/factories/week_day_factory.rb
  5. 2
      spec/lib/api/v3/days/day_collection_representer_spec.rb
  6. 2
      spec/models/day_spec.rb
  7. 2
      spec/requests/api/v3/days/day_spec.rb
  8. 2
      spec/requests/api/v3/days/week_spec.rb
  9. 4
      spec/services/work_packages/set_attributes_service_spec.rb
  10. 2
      spec/services/work_packages/set_schedule_service_working_days_spec.rb
  11. 2
      spec/services/work_packages/shared/shared_examples_days.rb
  12. 2
      spec/support_spec/schedule_helpers/chart_representer_spec.rb
  13. 2
      spec/support_spec/schedule_helpers/chart_spec.rb

@ -77,7 +77,7 @@ describe 'Calendar non working days', type: :feature, js: true do
context 'with all days marked as weekend' do
let!(:week_days) do
days = create(:week_days)
days = create(:week_days_with_saturday_and_sunday_as_weekend)
WeekDay.update_all(working: false)

@ -73,7 +73,7 @@ describe 'Team planner working days', type: :feature, js: true do
context 'with all days marked as weekend' do
let!(:week_days) do
days = create(:week_days)
days = create(:week_days_with_saturday_and_sunday_as_weekend)
WeekDay.update_all(working: false)

@ -600,7 +600,7 @@ describe WorkPackages::BaseContract do
context 'when setting duration and dates while covering non-working days' do
before do
create(:week_days) # sat and sun are weekends
create(:week_days_with_saturday_and_sunday_as_weekend)
work_package.ignore_non_working_days = false
work_package.duration = 6
work_package.start_date = "2022-08-22"
@ -623,7 +623,7 @@ describe WorkPackages::BaseContract do
context 'when setting duration and dates while covering non-working days and duration is too small' do
before do
create(:week_days) # sat and sun are weekends
create(:week_days_with_saturday_and_sunday_as_weekend)
work_package.ignore_non_working_days = false
work_package.duration = 1
work_package.start_date = "2022-08-22"
@ -646,7 +646,7 @@ describe WorkPackages::BaseContract do
context 'when setting duration and dates while covering non-working days and duration is too big' do
before do
create(:week_days) # sat and sun are weekends
create(:week_days_with_saturday_and_sunday_as_weekend)
work_package.ignore_non_working_days = false
work_package.duration = 99
work_package.start_date = "2022-08-22"

@ -43,7 +43,7 @@ FactoryBot.define do
end
# Factory to create all 7 week days at once, Saturday and Sunday being weekend days
factory :week_days, aliases: [:week_days_with_saturday_and_sunday_as_weekend], class: 'Array' do
factory :week_days_with_saturday_and_sunday_as_weekend, aliases: [:week_days], class: 'Array' do
# Skip the create callback to be able to use non-AR models. Otherwise FactoryBot will
# try to call #save! on any created object.
skip_create

@ -29,7 +29,7 @@
require 'spec_helper'
describe ::API::V3::Days::DayCollectionRepresenter do
let!(:week_days) { create(:week_days) }
let!(:week_days) { create(:week_days_with_saturday_and_sunday_as_weekend) }
let(:days) do
[
build(:day, date: Date.new(2022, 12, 27)),

@ -52,7 +52,7 @@ describe Day, type: :model do
let(:non_working_dates) { [date_range.begin, date_range.begin + 1.day] }
before do
create(:week_days)
create(:week_days_with_saturday_and_sunday_as_weekend)
non_working_dates.each { |date| create(:non_working_day, date:) }
end

@ -38,7 +38,7 @@ describe ::API::V3::Days::DaysAPI,
current_user { user }
before do
create(:week_days)
create(:week_days_with_saturday_and_sunday_as_weekend)
get api_v3_paths.path_for :days, filters:
end

@ -38,7 +38,7 @@ describe ::API::V3::Days::WeekAPI,
current_user { user }
before do
create(:week_days)
create(:week_days_with_saturday_and_sunday_as_weekend)
get api_v3_paths.days_week
end

@ -1039,7 +1039,7 @@ describe WorkPackages::SetAttributesService,
end
context 'with non-working days' do
shared_let(:week_days) { create(:week_days) }
shared_let(:week_days) { create(:week_days_with_saturday_and_sunday_as_weekend) }
let(:monday) { Time.zone.today.beginning_of_week }
let(:tuesday) { monday + 1.day }
let(:wednesday) { monday + 2.days }
@ -1648,7 +1648,7 @@ describe WorkPackages::SetAttributesService,
let(:soonest_start) { saturday }
before do
create(:week_days)
create(:week_days_with_saturday_and_sunday_as_weekend)
work_package.ignore_non_working_days = false
end

@ -31,7 +31,7 @@ require 'spec_helper'
describe WorkPackages::SetScheduleService, 'working days' do
create_shared_association_defaults_for_work_package_factory
shared_let(:week_days) { create(:week_days) }
shared_let(:week_days) { create(:week_days_with_saturday_and_sunday_as_weekend) }
let(:instance) do
described_class.new(user:, work_package:)

@ -29,7 +29,7 @@
Date::DATE_FORMATS[:wday_date] = '%a %-d %b %Y' # Fri 5 Aug 2022
RSpec.shared_context 'with weekend days Saturday and Sunday' do
shared_let(:week_days) { create(:week_days) }
shared_let(:week_days) { create(:week_days_with_saturday_and_sunday_as_weekend) }
end
RSpec.shared_context 'with non working days Christmas 2022 and new year 2023' do

@ -39,7 +39,7 @@ describe ScheduleHelpers::ChartRepresenter do
let(:sunday) { Date.new(2022, 6, 26) }
describe '#normalized_to_s' do
let!(:week_days) { create(:week_days) }
let!(:week_days) { create(:week_days_with_saturday_and_sunday_as_weekend) }
context 'when both charts have different work packages items and/or order' do
def to_first_columns(charts)

@ -157,7 +157,7 @@ describe ScheduleHelpers::Chart do
end
describe '#to_s' do
let!(:week_days) { create(:week_days) }
let!(:week_days) { create(:week_days_with_saturday_and_sunday_as_weekend) }
context 'with a chart built from ascii representation' do
let(:chart) do

Loading…
Cancel
Save