Skip to content
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
2 changes: 1 addition & 1 deletion CHECKS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WAIT=10
ATTEMPTS=20
ATTEMPTS=300

/users/sign_in Sign in to
7 changes: 6 additions & 1 deletion app/models/questionnaire.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ class Questionnaire < ApplicationRecord

validates :portfolio_url, url: { allow_blank: true }
validates :vcs_url, url: { allow_blank: true }
validates_format_of :vcs_url, with: %r{\A(((https?:\/\/)?(www\.)?github\.com\/\w+\/?)|((https?:\/\/)?(www\.)?gitlab\.com\/\w+\/?)|((https?:\/\/)?(www\.)?bitbucket\.org\/\w+\/?))\z}, allow_blank: true, message: "Must be a GitHub, GitLab or Bitbucket url"
validates_format_of :vcs_url,
with: %r{\A((https?:\/\/)?(www\.)?((github\.com)|(gitlab\.com)|(bitbucket\.org))\/(.*){0,62})\z}i,
allow_blank: true,
message: "Must be a GitHub, GitLab or Bitbucket url"
strip_attributes

POSSIBLE_EXPERIENCES = {
Expand Down Expand Up @@ -129,11 +132,13 @@ def email
end

def portfolio_url=(value)
value = value.downcase unless value.blank?
value = "http://" + value if !value.blank? && !value.include?("http://") && !value.include?("https://")
super value
end

def vcs_url=(value)
value = value.downcase unless value.blank?
value = "https://" + value if !value.blank? && !value.include?("http://") && !value.include?("https://")
super value
end
Expand Down
2 changes: 2 additions & 0 deletions test/models/questionnaire_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ class QuestionnaireTest < ActiveSupport::TestCase
should allow_value('foo.com').for(:portfolio_url)
should allow_value('github.com/foo', 'gitlab.com/bar', 'bitbucket.org/baz').for(:vcs_url)
should allow_value('https://github.com/foo', 'https://gitlab.com/bar', 'https://bitbucket.org/baz').for(:vcs_url)
should allow_value('HttPs://github.com/foo', 'hTTp://gitLAB.coM/bar').for(:vcs_url)
should allow_value('wWw.github.com/fOo', 'hTTp://wWw.gitLAB.coM/f-fc-vx').for(:vcs_url)
should_not allow_value('http://foo.com', 'https://bar.com').for(:vcs_url)

context "#school" do
Expand Down