Upgrade validate_url to 1.0.11 to fix load error (#7882)

* Upgrade validate_url to 1.0.11 to fix load error

* Fix spec
This commit is contained in:
rhymes 2020-05-15 16:17:07 +02:00 committed by GitHub
parent 03ff779ca3
commit e104c8b5c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 19 deletions

View file

@ -526,7 +526,7 @@ GEM
pry (~> 0.13.0)
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (4.0.4)
public_suffix (4.0.5)
puma (4.3.3)
nio4r (~> 2.0)
pundit (2.1.0)
@ -793,7 +793,7 @@ GEM
unicode_plot (0.0.4)
enumerable-statistics (>= 2.0.1)
uniform_notifier (1.13.0)
validate_url (1.0.8)
validate_url (1.0.11)
activemodel (>= 3.0.0)
public_suffix
vcr (5.1.0)

View file

@ -127,10 +127,10 @@ RSpec.describe Article, type: :model do
it "is not valid with spaces" do
invalid_url = "https://www.positronx.io/angular radio-buttons-example/"
article.canonical_url = invalid_url
messages = ["must not have spaces"]
message = "must not have spaces"
expect(article).not_to be_valid
expect(article.errors.messages[:canonical_url]).to eq messages
expect(article.errors.messages[:canonical_url]).to include(message)
end
end

View file

@ -14,7 +14,7 @@ require "test_prof/recipes/rspec/before_all"
require "test_prof/recipes/rspec/let_it_be"
require "test_prof/recipes/rspec/sample"
require "sidekiq/testing"
# require "validate_url/rspec_matcher"
require "validate_url/rspec_matcher"
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are

View file

@ -1,14 +0,0 @@
# NOTE: this is copied from https://github.com/perfectline/validates_url/blob/master/lib/validate_url/rspec_matcher.rb
# as the recommended include mechanism doesn't work. Will remove when that's patched correctly
RSpec::Matchers.define :validate_url_of do |attribute|
match do
actual = subject.is_a?(Class) ? subject.new : subject
actual.send(:"#{attribute}=", "htp://invalidurl")
expect(actual).to be_invalid
@expected_message ||= I18n.t("errors.messages.url")
expect(actual.errors.messages[attribute.to_sym]).to include(@expected_message)
end
chain :with_message do |message|
@expected_message = message
end
end