Skip to content

Commit

Permalink
style: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHulme committed Oct 5, 2023
1 parent 1b3bd1a commit e1cdb42
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
<title>
<% # Define a hash of environments
environments = {
cucumber: "🥒",
development: "🚧",
production: "🌎",
profile: "⏱️",
staging: "🚀",
staging_2: "🚀2️⃣",
test: "🧪",
training: "🎓",
cucumber: '🥒',
development: '🚧',
production: '🌎',
profile: '⏱️',
staging: '🚀',
staging_2: '🚀2️⃣', # rubocop:disable Naming/VariableNumber
test: '🧪',
training: '🎓',
}

# Get an emoji for the current environment
current_environment = Rails.env.to_sym
emoji = environments[current_environment] || "❓"
emoji = environments[current_environment] || '❓'
%>
<%= "#{emoji}:" unless Rails.env.production? %> Sequencescape : <%= controller.controller_name.capitalize %> - <%= @page_name || controller.action_name %>
</title>
Expand Down
18 changes: 9 additions & 9 deletions spec/views/layouts/application.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

RSpec.describe 'layouts/application', type: :view do
environments = {
cucumber: "🥒",
development: "🚧",
cucumber: '🥒',
development: '🚧',
# production is tested separately
profile: "⏱️",
staging: "🚀",
staging_2: "🚀2️⃣",
test: "🧪",
training: "🎓",
profile: '⏱️',
staging: '🚀',
staging_2: '🚀2️⃣', # rubocop:disable Naming/VariableNumber
test: '🧪',
training: '🎓'
}

environments.each do |env, emoji|
Expand All @@ -27,13 +27,13 @@
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('production'))
assign(:page_name, 'the homepage')
render
expect(rendered).to have_title("Sequencescape : Test - the homepage")
expect(rendered).to have_title('Sequencescape : Test - the homepage')
end

it 'displays the correct title with question mark emoji for undefined environment' do
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('undefined_environment'))
assign(:page_name, 'the homepage')
render
expect(rendered).to have_title("❓: Sequencescape : Test - the homepage")
expect(rendered).to have_title('❓: Sequencescape : Test - the homepage')
end
end

0 comments on commit e1cdb42

Please sign in to comment.