Skip to content

Commit

Permalink
SRCH-1772 validate RoutedQuery#url (#670)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmax-fearless authored Mar 19, 2021
1 parent e800f5a commit 075b622
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/routed_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class RoutedQuery < ApplicationRecord
validates_uniqueness_of :description, scope: :affiliate_id

validates :affiliate, presence: true
validates_format_of :url, with: URI.regexp
validates_url :url

validate :keywords_cannot_be_blank

Expand Down
1 change: 1 addition & 0 deletions spec/models/routed_query_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
it { is_expected.to validate_presence_of :affiliate }
it { is_expected.to allow_value('http://www.foo.com').for(:url) }
it { is_expected.not_to allow_value('www.foo.com').for(:url) }
it { is_expected.not_to allow_value('data:text/;&Tab.base64').for(:url) }

it 'creates a new instance given valid attributes' do
affiliate.routed_queries.create!(valid_attributes)
Expand Down

0 comments on commit 075b622

Please sign in to comment.