Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show day of week when not weekly #17359

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@meeting.recurring_meeting.human_day_of_week
end
end
end if @meeting.recurring_meeting.frequency != "daily"
end if @meeting.recurring_meeting.frequency_weekly?
else
if @series.present?
details.with_row(mb: 2) do
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# 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-2013 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 COPYRIGHT and LICENSE files for more details.
#++

require "rails_helper"

RSpec.describe Meetings::SidePanel::DetailsComponent, type: :component do
let(:user) { build_stubbed(:user) }

subject do
render_inline(described_class.new(meeting:))
page
end

before do
login_as(user)
end

context "with templated meeting and working_days frequency" do
let(:series) do
build_stubbed(:recurring_meeting,
start_time: DateTime.parse("2024-12-04T10:00:00Z"),
frequency: "working_days")
end
let(:meeting) do
build_stubbed(:structured_meeting_template,
recurring_meeting: series)
end

it "doesn't show the weekday" do
expect(subject).to have_no_text("Wednesday")
end
end

context "with templated meeting and weekly frequency" do
let(:series) do
build_stubbed(:recurring_meeting,
start_time: DateTime.parse("2024-12-04T10:00:00Z"),
frequency: "weekly")
end
let(:meeting) do
build_stubbed(:structured_meeting_template,
recurring_meeting: series)
end

it "shows the weekday" do
expect(subject).to have_text("Wednesday")
end
end
end
5 changes: 3 additions & 2 deletions modules/meeting/spec/factories/meeting_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@
recurring_meeting

after(:build) do |template, evaluator|
template.author = evaluator.recurring_meeting.author
template.project = evaluator.recurring_meeting.project
%w[author project start_time].each do |attr|
template.send(:"#{attr}=", evaluator.recurring_meeting.send(attr))
end
end
end
end
Expand Down
6 changes: 0 additions & 6 deletions modules/meeting/spec/factories/recurring_meeting_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,5 @@
recurring_meeting.project = project
recurring_meeting.template = create(:structured_meeting_template, recurring_meeting:, project:)
end

after(:stub) do |recurring_meeting, evaluator|
project = evaluator.project
recurring_meeting.project = project
recurring_meeting.template = build_stubbed(:structured_meeting_template, recurring_meeting:, project:)
end
end
end
Loading