Skip to content

Commit

Permalink
add time zone to conference_program, add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antopalidi committed Jan 5, 2024
1 parent 9d2796e commit 1ece7ad
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- replace '.programme-time' -->

<div class="column medium-2 programme-time">
<%= gpc_time_format start_time %><%= gpc_time_format end_time %>
<%= gpc_time_zone(start_time) %>
</div>
50 changes: 49 additions & 1 deletion spec/system/conference_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
# frozen_string_literal: true

require "rails_helper"

require "selenium/webdriver"

Capybara.register_driver :headless_chrome do |app|
options = Selenium::WebDriver::Chrome::Options.new
options.args << "--explicitly-allowed-ports=#{Capybara.server_port}"
options.args << "--headless-new"
options.args << "--no-sandbox"
options.args << if ENV["BIG_SCREEN_SIZE"].present?
"--window-size=1920,3000"
else
"--window-size=1920,1080"
end
options.args << "--ignore-certificate-errors" if ENV["TEST_SSL"]
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
options: options
)
end
describe "Visit a conference", type: :system do
let(:organization) { create :organization }
let(:conference) { create :conference, slug: slug, registrations_enabled: registrations_enabled, organization: organization }
Expand Down Expand Up @@ -76,4 +94,34 @@
it_behaves_like "no links"
end
end

context "when conference program show" do
let(:organization) { create :organization, time_zone: "UTC" }
let!(:component) { create(:component, manifest_name: :meetings, participatory_space: conference) }
let!(:conference_speakers) { create_list(:conference_speaker, 3, :with_meeting, conference: conference, meetings_component: component) }
let(:meetings) { Decidim::ConferenceMeeting.where(component: component) }
let!(:user) { create(:user, :confirmed, organization: organization, time_zone: timezone) }
let(:timezone) { "CET" }

context "when the user is logged in" do
before do
sign_in user
visit decidim_conferences.conference_conference_program_path(conference, component)
end

it "shows user's time zone" do
expect(page).to have_content("CET")
end
end

context "when the user is not logged in" do
before do
visit decidim_conferences.conference_conference_program_path(conference, component)
end

it "shows the organization's time zone" do
expect(page).to have_content("UTC")
end
end
end
end

0 comments on commit 1ece7ad

Please sign in to comment.