Merge pull request #2986 from openSUSE/depfu/update/rubocop-rspec-2.10.0

Update rubocop-rspec: 2.4.0 → 2.10.0 (minor)
This commit is contained in:
Henne Vogelsang 2022-05-09 12:23:04 +02:00 committed by GitHub
commit 83c31ed50a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 59 additions and 108 deletions

View file

@ -5,7 +5,7 @@ end
source 'https://rubygems.org' source 'https://rubygems.org'
ruby ENV['OSEM_RUBY_VERSION'] || '3.1.2' ruby ENV.fetch('OSEM_RUBY_VERSION', '3.1.2')
# rails-assets requires >= 1.8.4 # rails-assets requires >= 1.8.4
if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.8.4') if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.8.4')

View file

@ -389,8 +389,8 @@ GEM
paper_trail (12.2.0) paper_trail (12.2.0)
activerecord (>= 5.2) activerecord (>= 5.2)
request_store (~> 1.1) request_store (~> 1.1)
parallel (1.21.0) parallel (1.22.1)
parser (3.1.1.0) parser (3.1.2.0)
ast (~> 2.4.1) ast (~> 2.4.1)
pdf-core (0.9.0) pdf-core (0.9.0)
pdf-inspector (1.3.0) pdf-inspector (1.3.0)
@ -464,7 +464,7 @@ GEM
recaptcha (5.8.1) recaptcha (5.8.1)
json json
redcarpet (3.5.1) redcarpet (3.5.1)
regexp_parser (2.2.1) regexp_parser (2.3.1)
request_store (1.5.1) request_store (1.5.1)
rack (>= 1.4) rack (>= 1.4)
responders (3.0.1) responders (3.0.1)
@ -502,24 +502,23 @@ GEM
rspec-mocks (~> 3.10) rspec-mocks (~> 3.10)
rspec-support (~> 3.10) rspec-support (~> 3.10)
rspec-support (3.10.2) rspec-support (3.10.2)
rubocop (1.25.1) rubocop (1.28.2)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 3.1.0.0) parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0) regexp_parser (>= 1.8, < 3.0)
rexml rexml
rubocop-ast (>= 1.15.1, < 2.0) rubocop-ast (>= 1.17.0, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.16.0) rubocop-ast (1.17.0)
parser (>= 3.1.1.0) parser (>= 3.1.1.0)
rubocop-rails (2.13.2) rubocop-rails (2.13.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
rack (>= 1.1) rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0) rubocop (>= 1.7.0, < 2.0)
rubocop-rspec (2.4.0) rubocop-rspec (2.10.0)
rubocop (~> 1.0) rubocop (~> 1.19)
rubocop-ast (>= 1.1.0)
ruby-oembed (0.15.0) ruby-oembed (0.15.0)
ruby-openid (2.9.2) ruby-openid (2.9.2)
ruby-progressbar (1.11.0) ruby-progressbar (1.11.0)

View file

@ -116,7 +116,7 @@ module ApplicationHelper
end end
def sign_in_path def sign_in_path
if ENV['OSEM_ICHAIN_ENABLED'] == 'true' if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) == 'true'
new_user_ichain_session_path new_user_ichain_session_path
else else
new_user_session_path new_user_session_path
@ -140,9 +140,7 @@ module ApplicationHelper
def nav_root_link_for(conference) def nav_root_link_for(conference)
link_text = ( link_text = (
conference.try(:organization).try(:name) || conference.try(:organization).try(:name) || ENV.fetch('OSEM_NAME', 'OSEM')
ENV['OSEM_NAME'] ||
'OSEM'
) )
link_to( link_to(
link_text, link_text,

View file

@ -19,7 +19,7 @@ module UsersHelper
unless Rails.application.secrets.send(provider_key).blank? || Rails.application.secrets.send(provider_secret).blank? unless Rails.application.secrets.send(provider_key).blank? || Rails.application.secrets.send(provider_secret).blank?
providers << provider providers << provider
end end
providers << provider if !ENV["OSEM_#{provider.upcase}_KEY"].blank? && !ENV["OSEM_#{provider.upcase}_SECRET"].blank? providers << provider if ENV.fetch("OSEM_#{provider.upcase}_KEY", nil).present? && ENV.fetch("OSEM_#{provider.upcase}_SECRET", nil).present?
end end
providers.uniq providers.uniq

View file

@ -42,7 +42,7 @@ class Ability
can [:index, :show], Survey, surveyable_type: 'Conference' can [:index, :show], Survey, surveyable_type: 'Conference'
# Things that are possible without ichain enabled that are **not*+ possible with ichain mode enabled. # Things that are possible without ichain enabled that are **not*+ possible with ichain mode enabled.
if ENV['OSEM_ICHAIN_ENABLED'] != 'true' if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) != 'true'
# There is no reliable way for this workflow (enable not logged in users to fill out a form, then telling # There is no reliable way for this workflow (enable not logged in users to fill out a form, then telling
# them to sign up once they submit) in ichain. So enable it only without ichain. # them to sign up once they submit) in ichain. So enable it only without ichain.

View file

@ -51,7 +51,7 @@ class AdminAbility
# for admins # for admins
can :manage, :all if user.is_admin can :manage, :all if user.is_admin
# even admin cannot create new users with ICHAIN enabled # even admin cannot create new users with ICHAIN enabled
cannot [:new, :create], User if ENV['OSEM_ICHAIN_ENABLED'] == 'true' cannot [:new, :create], User if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) == 'true'
cannot :revert_object, PaperTrail::Version do |version| cannot :revert_object, PaperTrail::Version do |version|
(version.event == 'create' && %w[Conference User Event].include?(version.item_type)) (version.event == 'create' && %w[Conference User Event].include?(version.item_type))
end end

View file

@ -13,12 +13,12 @@ class EmailSettings < ApplicationRecord
'conference_start_date' => conference.start_date, 'conference_start_date' => conference.start_date,
'conference_end_date' => conference.end_date, 'conference_end_date' => conference.end_date,
'registrationlink' => Rails.application.routes.url_helpers.conference_conference_registration_url( 'registrationlink' => Rails.application.routes.url_helpers.conference_conference_registration_url(
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')), conference.short_title, host: ENV.fetch('OSEM_HOSTNAME', 'localhost:3000')),
'conference_splash_link' => Rails.application.routes.url_helpers.conference_url( 'conference_splash_link' => Rails.application.routes.url_helpers.conference_url(
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')), conference.short_title, host: ENV.fetch('OSEM_HOSTNAME', 'localhost:3000')),
'schedule_link' => Rails.application.routes.url_helpers.conference_schedule_url( 'schedule_link' => Rails.application.routes.url_helpers.conference_schedule_url(
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')) conference.short_title, host: ENV.fetch('OSEM_HOSTNAME', 'localhost:3000'))
} }
if conference.program.cfp if conference.program.cfp
@ -45,7 +45,7 @@ class EmailSettings < ApplicationRecord
if event if event
h['eventtitle'] = event.title h['eventtitle'] = event.title
h['proposalslink'] = Rails.application.routes.url_helpers.conference_program_proposals_url( h['proposalslink'] = Rails.application.routes.url_helpers.conference_program_proposals_url(
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')) conference.short_title, host: ENV.fetch('OSEM_HOSTNAME', 'localhost:3000'))
end end
if booth if booth

View file

@ -51,7 +51,7 @@ class User < ApplicationRecord
# :lockable, :timeoutable and :omniauthable # :lockable, :timeoutable and :omniauthable
devise_modules = [] devise_modules = []
devise_modules += if ENV['OSEM_ICHAIN_ENABLED'] == 'true' devise_modules += if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) == 'true'
[:ichain_authenticatable, :ichain_registerable, :omniauthable, omniauth_providers: []] [:ichain_authenticatable, :ichain_registerable, :omniauthable, omniauth_providers: []]
else else
[:database_authenticatable, :registerable, [:database_authenticatable, :registerable,

View file

@ -11,7 +11,7 @@
%legend %legend
%span %span
=link_to('#signup', role: 'tab', "aria-controls" => "home", "data-toggle" => "tab") do =link_to('#signup', role: 'tab', "aria-controls" => "home", "data-toggle" => "tab") do
= ENV['OSEM_NAME'] || 'OSEM' = ENV.fetch('OSEM_NAME', 'OSEM')
Account Account
%span.pull-right#account-already %span.pull-right#account-already
=link_to('#signin', role: 'tab', "aria-controls" => "home", "data-toggle" => "tab") do =link_to('#signin', role: 'tab', "aria-controls" => "home", "data-toggle" => "tab") do

View file

@ -11,7 +11,7 @@
%legend %legend
%span %span
=link_to('#signup', role: 'tab', "aria-controls" => "home", "data-toggle" => "tab") do =link_to('#signup', role: 'tab', "aria-controls" => "home", "data-toggle" => "tab") do
= ENV['OSEM_NAME'] || 'OSEM' = ENV.fetch('OSEM_NAME', 'OSEM')
Account Account
%span.pull-right#account-already %span.pull-right#account-already
=link_to('#signin', role: 'tab', "aria-controls" => "home", "data-toggle" => "tab") do =link_to('#signin', role: 'tab', "aria-controls" => "home", "data-toggle" => "tab") do

View file

@ -9,7 +9,7 @@
installation! installation!
%p %p
The first user to The first user to
- if ENV['OSEM_ICHAIN_ENABLED'] == 'true' - if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) == 'true'
= link_to(new_ichain_registration_path('user')) do = link_to(new_ichain_registration_path('user')) do
sign up sign up
- else - else

View file

@ -1,6 +1,6 @@
- content_for :head do - content_for :head do
%meta{ property: "og:title", content: @conference.title } %meta{ property: "og:title", content: @conference.title }
%meta{ property: "og:site_name", content: (ENV['OSEM_NAME'] || 'OSEM') } %meta{ property: "og:site_name", content: ENV.fetch('OSEM_NAME', 'OSEM') }
%meta{ property: "og:description", content: @conference.description } %meta{ property: "og:description", content: @conference.description }
%meta{ property: "og:url", content: conference_url(@conference.short_title) } %meta{ property: "og:url", content: conference_url(@conference.short_title) }
%meta{ property: "twitter:title", content: (@conference.title) } %meta{ property: "twitter:title", content: (@conference.title) }

View file

@ -1,4 +1,4 @@
- if ENV['OSEM_ICHAIN_ENABLED'] != 'true' - if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) != 'true'
= form_tag(new_user_session_path, class: 'form-horizontal') do = form_tag(new_user_session_path, class: 'form-horizontal') do
%legend %legend
%span %span

View file

@ -37,7 +37,7 @@
= link_to(admin_revision_history_path) do = link_to(admin_revision_history_path) do
%span.fa.fa-history %span.fa.fa-history
Revision History Revision History
- if ENV['ORGANIZATIONS_ENABLED'] == 'true' - if ENV.fetch('ORGANIZATIONS_ENABLED', nil) == 'true'
%li %li
= link_to(admin_organizations_path) do = link_to(admin_organizations_path) do
%span.fa.fa-group %span.fa.fa-group

View file

@ -32,7 +32,7 @@
= render 'layouts/user_menu' = render 'layouts/user_menu'
- else - else
%ul.nav.navbar-nav.navbar-right %ul.nav.navbar-nav.navbar-right
- if ENV['OSEM_ICHAIN_ENABLED'] == 'true' - if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) == 'true'
%li{class: "#{active_nav_li(new_ichain_registration_path('user'))}"} %li{class: "#{active_nav_li(new_ichain_registration_path('user'))}"}
= link_to(new_ichain_registration_path('user')) do = link_to(new_ichain_registration_path('user')) do
%span.fa.fa-heart %span.fa.fa-heart
@ -48,7 +48,7 @@
Sign In Sign In
%span.caret %span.caret
.dropdown-menu .dropdown-menu
- if ENV['OSEM_ICHAIN_ENABLED'] == 'true' - if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) == 'true'
= form_tag User.ichain_login_url do = form_tag User.ichain_login_url do
= text_field_tag 'username', nil, id: 'user_ichain_email_dd', class: 'form-control', placeholder: 'Username' = text_field_tag 'username', nil, id: 'user_ichain_email_dd', class: 'form-control', placeholder: 'Username'
= password_field_tag 'password', nil, id: 'user_ichain_password_dd', class: 'form-control', placeholder: 'Password' = password_field_tag 'password', nil, id: 'user_ichain_password_dd', class: 'form-control', placeholder: 'Password'

View file

@ -10,7 +10,7 @@
%li= link_to "See all unread Comments (#{unread_notifications(current_user).length})", admin_comments_path %li= link_to "See all unread Comments (#{unread_notifications(current_user).length})", admin_comments_path
%li= link_to 'See all Comments', admin_comments_path(anchor: 'all_comments') %li= link_to 'See all Comments', admin_comments_path(anchor: 'all_comments')
%li.divider %li.divider
- unless ENV['OSEM_ICHAIN_ENABLED'] == 'true' - unless ENV.fetch('OSEM_ICHAIN_ENABLED', nil) == 'true'
%li %li
= link_to(edit_user_registration_path) do = link_to(edit_user_registration_path) do
%span.fa.fa-wrench %span.fa.fa-wrench
@ -40,7 +40,7 @@
%span.fa.fa-shopping-bag %span.fa.fa-shopping-bag
My #{(t'booth').capitalize } Requests My #{(t'booth').capitalize } Requests
%li %li
- if ENV['OSEM_ICHAIN_ENABLED'] == 'true' - if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) == 'true'
= link_to(destroy_user_ichain_session_path, method: 'delete') do = link_to(destroy_user_ichain_session_path, method: 'delete') do
%span.fa.fa-minus %span.fa.fa-minus
Sign out Sign out
@ -76,7 +76,7 @@
= link_to(admin_revision_history_path) do = link_to(admin_revision_history_path) do
%span.fa.fa-history %span.fa.fa-history
Revision History Revision History
- if ENV['ORGANIZATIONS_ENABLED'] == 'true' - if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) == 'true'
%li %li
= link_to(admin_organizations_path) do = link_to(admin_organizations_path) do
%span.fa.fa-group %span.fa.fa-group

View file

@ -2,7 +2,7 @@
%head %head
%meta{charset: 'utf-8'} %meta{charset: 'utf-8'}
%meta{name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1'} %meta{name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1'}
%title= content_for?(:title) ? yield(:title) : (ENV['OSEM_NAME'] || 'OSEM') %title= content_for?(:title) ? yield(:title) : ENV.fetch('OSEM_NAME', 'OSEM')
%meta{content: '', name: 'description'} %meta{content: '', name: 'description'}
%meta{content: '', name: 'author'} %meta{content: '', name: 'author'}
= stylesheet_link_tag "application", media: 'all' = stylesheet_link_tag "application", media: 'all'
@ -10,7 +10,7 @@
= csrf_meta_tags = csrf_meta_tags
= content_for(:script_head) = content_for(:script_head)
- if ENV['OSEM_TRANSIFEX_APIKEY'] - if ENV.fetch('OSEM_TRANSIFEX_APIKEY', nil)
:javascript :javascript
window.liveSettings = { window.liveSettings = {
api_key: "#{ENV['OSEM_TRANSIFEX_APIKEY']}", api_key: "#{ENV['OSEM_TRANSIFEX_APIKEY']}",
@ -46,7 +46,7 @@
You can run, copy, distribute, study, change and improve it. You can run, copy, distribute, study, change and improve it.
The source code and the developers are on The source code and the developers are on
#{link_to "GitHub", "https://github.com/openSUSE/osem"}. #{link_to "GitHub", "https://github.com/openSUSE/osem"}.
- if ENV["SKYLIGHT_PUBLIC_DASHBOARD_URL"].present? - if ENV.fetch('SKYLIGHT_PUBLIC_DASHBOARD_URL', nil)
Performance data is available on Performance data is available on
#{link_to "Skylight", ENV["SKYLIGHT_PUBLIC_DASHBOARD_URL"]}. #{link_to "Skylight", ENV["SKYLIGHT_PUBLIC_DASHBOARD_URL"]}.
= yield :script_body = yield :script_body

View file

@ -22,6 +22,6 @@
= form_tag conference_payments_path do = form_tag conference_payments_path do
%script.stripe-button{ src: "https://checkout.stripe.com/checkout.js", %script.stripe-button{ src: "https://checkout.stripe.com/checkout.js",
data: { amount: @total_amount_to_pay.cents, label: "Pay #{humanized_money_with_symbol @total_amount_to_pay}", data: { amount: @total_amount_to_pay.cents, label: "Pay #{humanized_money_with_symbol @total_amount_to_pay}",
email: current_user.email, currency: @total_amount_to_pay.currency, name: ENV['OSEM_NAME'] || 'OSEM', email: current_user.email, currency: @total_amount_to_pay.currency, name: ENV.fetch('OSEM_NAME', 'OSEM'),
description: "book your tickets", key: Rails.application.secrets.stripe_publishable_key, locale: "auto"}} description: "book your tickets", key: Rails.application.secrets.stripe_publishable_key, locale: "auto"}}
= link_to 'Edit Purchase', conference_tickets_path(@conference.short_title), class: 'btn btn-default' = link_to 'Edit Purchase', conference_tickets_path(@conference.short_title), class: 'btn btn-default'

View file

@ -17,7 +17,7 @@
%legend %legend
%span %span
=link_to('#signup', role: 'tab', 'aria-controls' => 'home', 'data-toggle' => 'tab') do =link_to('#signup', role: 'tab', 'aria-controls' => 'home', 'data-toggle' => 'tab') do
= ENV['OSEM_NAME'] || 'OSEM' = ENV.fetch('OSEM_NAME', 'OSEM')
Account Account
%span.pull-right#account-already %span.pull-right#account-already
=link_to('#signin', role: 'tab', 'aria-controls' => 'home', 'data-toggle' => 'tab') do =link_to('#signin', role: 'tab', 'aria-controls' => 'home', 'data-toggle' => 'tab') do

View file

@ -2,7 +2,7 @@
%meta{ property: "og:title", content: @event.title } %meta{ property: "og:title", content: @event.title }
%meta{ property: "og:url", content: conference_program_proposal_url(@conference.short_title, @event) } %meta{ property: "og:url", content: conference_program_proposal_url(@conference.short_title, @event) }
%meta{ property: "og:description", content: @event.abstract } %meta{ property: "og:description", content: @event.abstract }
%meta{ property: "og:site_name", content: (ENV['OSEM_NAME'] || 'OSEM') } %meta{ property: "og:site_name", content: ENV.fetch('OSEM_NAME', 'OSEM') }
- if @speakers_ordered.any? - if @speakers_ordered.any?
%meta{ property: "og:image", content: @speakers_ordered.first.gravatar_url } %meta{ property: "og:image", content: @speakers_ordered.first.gravatar_url }
%meta{ property: "og:image:secure_url", content: @speakers_ordered.first.gravatar_url } %meta{ property: "og:image:secure_url", content: @speakers_ordered.first.gravatar_url }

View file

@ -18,7 +18,7 @@ m = Module.new do
end end
def env_var_version def env_var_version
ENV['BUNDLER_VERSION'] ENV.fetch('BUNDLER_VERSION', nil)
end end
def cli_arg_version def cli_arg_version
@ -40,7 +40,7 @@ m = Module.new do
end end
def gemfile def gemfile
gemfile = ENV['BUNDLE_GEMFILE'] gemfile = ENV.fetch('BUNDLE_GEMFILE', nil)
return gemfile if gemfile && !gemfile.empty? return gemfile if gemfile && !gemfile.empty?
File.expand_path('../../Gemfile', __FILE__) File.expand_path('../../Gemfile', __FILE__)

View file

@ -1,19 +1,19 @@
<% <%
encoding = 'unicode' encoding = 'unicode'
if ENV['OSEM_DB_ADAPTER'] == 'mysql2' if ENV.fetch('OSEM_DB_ADAPTER', nil) == 'mysql2'
encoding = 'utf8' encoding = 'utf8'
end end
%> %>
default: &default default: &default
adapter: <%= ENV['OSEM_DB_ADAPTER'] || 'postgresql' %> adapter: <%= ENV.fetch('OSEM_DB_ADAPTER', 'postgresql') %>
encoding: <%= encoding %> encoding: <%= encoding %>
host: <%= ENV['OSEM_DB_HOST'] || 'database' %> host: <%= ENV.fetch('OSEM_DB_HOST', 'database') %>
port: <%= ENV['OSEM_DB_PORT'] || '5432' %> port: <%= ENV.fetch('OSEM_DB_PORT', '5432') %>
username: <%= ENV['OSEM_DB_USER'] || 'postgres' %> username: <%= ENV.fetch('OSEM_DB_USER', 'postgres') %>
password: <%= ENV['OSEM_DB_PASSWORD'] || 'mysecretpassword' %> password: <%= ENV.fetch('OSEM_DB_PASSWORD', 'mysecretpassword') %>
database: <%= ENV['OSEM_DB_NAME'] || 'postgres' %> database: <%= ENV.fetch('OSEM_DB_NAME', 'postgres') %>
pool: 5 pool: 5
timeout: 5000 timeout: 5000

View file

@ -55,7 +55,7 @@ Rails.application.configure do
# config.action_view.annotate_rendered_view_with_filenames = true # config.action_view.annotate_rendered_view_with_filenames = true
# Set the detault url for action mailer # Set the detault url for action mailer
config.action_mailer.default_url_options = { host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000') } config.action_mailer.default_url_options = { host: ENV.fetch('OSEM_HOSTNAME', 'localhost:3000') }
# Access all mails sent at http://localhost:3000/letter_opener # Access all mails sent at http://localhost:3000/letter_opener
config.action_mailer.delivery_method = :letter_opener config.action_mailer.delivery_method = :letter_opener

View file

@ -7,16 +7,16 @@ Devise.setup do |config|
# Pass each provider to User model in :omniauth_providers (for open_id providers use their name) # Pass each provider to User model in :omniauth_providers (for open_id providers use their name)
config.omniauth :open_id, name: 'suse', identifier: 'http://www.opensuse.org/openid/user' config.omniauth :open_id, name: 'suse', identifier: 'http://www.opensuse.org/openid/user'
config.omniauth :google_oauth2, (ENV['OSEM_GOOGLE_KEY'] || Rails.application.secrets.google_key), (ENV['OSEM_GOOGLE_SECRET'] || Rails.application.secrets.google_secret), config.omniauth :google_oauth2, ENV.fetch('OSEM_GOOGLE_KEY', Rails.application.secrets.google_key), ENV.fetch('OSEM_GOOGLE_SECRET', Rails.application.secrets.google_secret),
name: 'google', name: 'google',
scope: 'email' scope: 'email'
config.omniauth :facebook, (ENV['OSEM_FACEBOOK_KEY'] || Rails.application.secrets.facebook_key), (ENV['OSEM_FACEBOOK_SECRET'] || Rails.application.secrets.facebook_secret) config.omniauth :facebook, ENV.fetch('OSEM_FACEBOOK_KEY', Rails.application.secrets.facebook_key), ENV.fetch('OSEM_FACEBOOK_SECRET', Rails.application.secrets.facebook_secret)
config.omniauth :github, (ENV['OSEM_GITHUB_KEY'] || Rails.application.secrets.github_key), (ENV['OSEM_GITHUB_SECRET'] || Rails.application.secrets.github_secret) config.omniauth :github, ENV.fetch('OSEM_GITHUB_KEY', Rails.application.secrets.github_key), ENV.fetch('OSEM_GITHUB_SECRET', Rails.application.secrets.github_secret)
# ==> Mailer Configuration # ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer, # Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class with default "from" parameter. # note that it will be overwritten if you use your own mailer class with default "from" parameter.
config.mailer_sender = ENV['OSEM_EMAIL_ADDRESS'] || 'no-reply@localhost' config.mailer_sender = ENV.fetch('OSEM_EMAIL_ADDRESS', 'no-reply@localhost')
# Configure the class responsible to send e-mails. # Configure the class responsible to send e-mails.
# config.mailer = "Devise::Mailer" # config.mailer = "Devise::Mailer"

View file

@ -13,9 +13,9 @@
default: &default default: &default
id_site: <%= ENV['OSEM_PIWIK_ID'] %> id_site: <%= ENV['OSEM_PIWIK_ID'] %>
url: <%= ENV['OSEM_PIWIK_URL'] %> url: <%= ENV['OSEM_PIWIK_URL'] %>
use_async: <%= ENV['OSEM_PIWIK_ASYNC'] || false %> use_async: <%= ENV.fetch('OSEM_PIWIK_ASYNC', false) %>
disabled: <%= ENV['OSEM_PIWIK_DISABLED'] || true %> disabled: <%= ENV.fetch('OSEM_PIWIK_DISABLED', true) %>
hostname: <%= ENV['OSEM_PIWIK_HOSTNAME'] || 'localhost' %> hostname: <%= ENV.fetch('OSEM_PIWIK_HOSTNAME', 'localhost') %>
production: production:
piwik: piwik:

View file

@ -5,7 +5,7 @@ Osem::Application.routes.draw do
get '/', to: 'conferences#show' get '/', to: 'conferences#show'
end end
if ENV['OSEM_ICHAIN_ENABLED'] == 'true' if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) == 'true'
devise_for :users, controllers: { registrations: :registrations } devise_for :users, controllers: { registrations: :registrations }
else else
devise_for :users, devise_for :users,
@ -225,8 +225,8 @@ Osem::Application.routes.draw do
get '/calendar' => 'conferences#calendar' get '/calendar' => 'conferences#calendar'
unless ENV['OSEM_ROOT_CONFERENCE'].blank? if ENV.fetch('OSEM_ROOT_CONFERENCE', nil)
root to: redirect("/conferences/#{ENV['OSEM_ROOT_CONFERENCE']}") root to: redirect("/conferences/#{ENV.fetch('OSEM_ROOT_CONFERENCE')}")
else else
root to: 'conferences#index', via: [:get, :options] root to: 'conferences#index', via: [:get, :options]
end end

View file

@ -33,46 +33,5 @@ describe ApplicationController, type: :controller do
end end
end end
end end
end end
end
describe ApplicationController, type: :request do
let(:conference) { create(:conference) }
describe 'Skylight link' do
around do |example|
original_value = ENV['SKYLIGHT_PUBLIC_DASHBOARD_URL']
example.run
ENV['SKYLIGHT_PUBLIC_DASHBOARD_URL'] = original_value
end
context 'when SKYLIGHT_PUBLIC_DASHBOARD_URL is set' do
before do
ENV['SKYLIGHT_PUBLIC_DASHBOARD_URL'] = 'https://oss.skylight.io/app/applications/my-osem'
end
it 'should include a link to view performance data' do
get '/'
expect(response.body).to match(/Performance data/i)
expect(response.body).to include('https://oss.skylight.io/app/applications/my-osem')
end
end
context 'when SKYLIGHT_PUBLIC_DASHBOARD_URL is not set' do
before do
ENV['SKYLIGHT_PUBLIC_DASHBOARD_URL'] = nil
end
it 'should not include a link to view performance data' do
get '/'
expect(response.body).to_not match(/performance data/i)
expect(response.body).to_not match(/skylight/i)
end
end
end
end end

View file

@ -68,11 +68,6 @@ describe ApplicationHelper, type: :helper do
expect(nav_root_link_for(nil)).to match 'OSEM' expect(nav_root_link_for(nil)).to match 'OSEM'
end end
it 'should use the environment variable' do
ENV['OSEM_NAME'] = Faker::Company.name + "'"
expect(nav_root_link_for(nil)).to match h(ENV['OSEM_NAME'])
end
it 'should use the conference organization name' do it 'should use the conference organization name' do
expect(nav_root_link_for(conference)).to match h(conference.organization.name) expect(nav_root_link_for(conference)).to match h(conference.organization.name)
end end

View file

@ -85,7 +85,7 @@ RSpec.configure do |config|
# use a real browser for JS tests # use a real browser for JS tests
Capybara.javascript_driver = ( Capybara.javascript_driver = (
ENV['OSEM_TEST_DRIVER'].try(:to_sym) || :chrome_headless ENV.fetch('OSEM_TEST_DRIVER', 'chrome_headless').to_sym
) )
# Includes helpers and connect them to specific types of tests # Includes helpers and connect them to specific types of tests

View file

@ -1,10 +1,10 @@
RSpec.configure do |config| RSpec.configure do |config|
# Tracker deprecation messages in each file # Tracker deprecation messages in each file
if ENV['DEPRECATION_TRACKER'] if ENV.fetch('DEPRECATION_TRACKER', nil)
DeprecationTracker.track_rspec( DeprecationTracker.track_rspec(
config, config,
shitlist_path: 'spec/support/deprecation_shitlist.json', shitlist_path: 'spec/support/deprecation_shitlist.json',
mode: ENV['DEPRECATION_TRACKER'], mode: ENV.fetch('DEPRECATION_TRACKER'),
transform_message: ->(message) { message.gsub("#{Rails.root}/", '') } transform_message: ->(message) { message.gsub("#{Rails.root}/", '') }
) )
end end