Skip to content

Commit

Permalink
Make single source of truth for URL field size
Browse files Browse the repository at this point in the history
Single-ish, since we're not touching existing database migrations. But
this should make it easier to change the field size in future.
  • Loading branch information
thatandromeda committed Apr 7, 2020
1 parent be92303 commit f0a47ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions spec/models/copyrighted_url_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

context 'automatic validations' do
it { is_expected.to validate_presence_of(:url_original) }
it { is_expected.to validate_length_of(:url).is_at_most(8.kilobytes) }
it { is_expected.to validate_length_of(:url_original).is_at_most(8.kilobytes) }
it { is_expected.to validate_length_of(:url).is_at_most(ValidatesUrls::MAX_LENGTH) }
it { is_expected.to validate_length_of(:url_original).is_at_most(ValidatesUrls::MAX_LENGTH) }

it 'validates format of URLs' do
url = 'https://tilde.club:443/path/to/myfile.html?utf8=✓#AnchorGoesHere'
Expand Down
4 changes: 2 additions & 2 deletions spec/models/infringing_url_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

context 'automatic validations' do
it { is_expected.to validate_presence_of(:url_original) }
it { is_expected.to validate_length_of(:url).is_at_most(8.kilobytes) }
it { is_expected.to validate_length_of(:url_original).is_at_most(8.kilobytes) }
it { is_expected.to validate_length_of(:url).is_at_most(ValidatesUrls::MAX_LENGTH) }
it { is_expected.to validate_length_of(:url_original).is_at_most(ValidatesUrls::MAX_LENGTH) }

it 'validates format of URLs' do
url = 'https://tilde.club:443/path/to/myfile.html?utf8=✓#AnchorGoesHere'
Expand Down

0 comments on commit f0a47ee

Please sign in to comment.