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

Replace dots in review app subdomains #816

Merged
merged 1 commit into from
Aug 26, 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
4 changes: 2 additions & 2 deletions app/models/review_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def computed_environment
]
end

# replace underscores and downcase - not valid as subdomain
# replace dots & underscores and downcase - not valid as subdomain
def sanitized_subject
subject.downcase.gsub('_', '-')
subject.downcase.gsub(/[._]/, '-')
end
end
4 changes: 2 additions & 2 deletions spec/models/review_app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
context 'when an invalid subject is passed' do
let(:review_app) {
group.review_apps.new(
subject: "subject_With_Caps_And_Underscores",
subject: "subject_With_Caps_And.Underscores",
image_name: "image",
image_tag: "tag",
retention: 12 * 3600,
Expand All @@ -57,7 +57,7 @@
expect{review_app.save!}.to_not raise_error
end

it "converts the underscores to hyphens" do
it "converts the dots and underscores to hyphens" do
expect(review_app.to_param).to eq('subject-with-caps-and-underscores')
expect(review_app.slug).to eq('review---subject-with-caps-and-underscores')
end
Expand Down
Loading