diff --git a/app/models/review_app.rb b/app/models/review_app.rb index f3bfdca4..70cd0ce9 100644 --- a/app/models/review_app.rb +++ b/app/models/review_app.rb @@ -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 diff --git a/spec/models/review_app_spec.rb b/spec/models/review_app_spec.rb index 60cf0e0a..e8436258 100644 --- a/spec/models/review_app_spec.rb +++ b/spec/models/review_app_spec.rb @@ -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, @@ -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