From 58777ed7bb3a31f0952fd0d4e2df59abff32f705 Mon Sep 17 00:00:00 2001 From: Clarissa Borges Date: Sat, 27 Mar 2021 16:26:34 -0300 Subject: [PATCH] Use validates_url gem to validate Nonprofit's website --- Gemfile | 3 + Gemfile.lock | 4 + NOTICE-ruby | 348 +++++----------------------------- app/models/nonprofit.rb | 2 +- spec/models/nonprofit_spec.rb | 7 +- spec/spec_helper.rb | 1 + 6 files changed, 63 insertions(+), 302 deletions(-) diff --git a/Gemfile b/Gemfile index 64e3ab08..d0de864e 100755 --- a/Gemfile +++ b/Gemfile @@ -43,6 +43,9 @@ gem 'fast_blank' # Images gem 'image_processing', '~> 1.10.3' +# URL validation +gem 'validate_url' + # User authentication # https://github.com/plataformatec/devise gem 'devise-async', '~> 1.0' diff --git a/Gemfile.lock b/Gemfile.lock index 35aab6c6..5fe1507e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -389,6 +389,9 @@ GEM unf_ext (0.0.7.7) unicode-display_width (2.0.0) unicode_utils (1.4.0) + validate_url (1.0.13) + activemodel (>= 3.0.0) + public_suffix warden (1.2.9) rack (>= 2.0.9) webmock (3.11.0) @@ -469,6 +472,7 @@ DEPENDENCIES test-unit (~> 3.3) timecop (~> 0.9.1) traceroute (~> 0.8.0) + validate_url webmock (~> 3.6, >= 3.6.2) webpacker (~> 5.2.1) wisper-rspec (~> 1.1.0) diff --git a/NOTICE-ruby b/NOTICE-ruby index debf0948..ee8789d3 100644 --- a/NOTICE-ruby +++ b/NOTICE-ruby @@ -1106,38 +1106,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------- - -** actionmailer; version 6.1.3 -- -** actionpack; version 6.1.3 -- -** actionview; version 6.1.3 -- -** activemodel; version 6.1.3 -- -** railties; version 6.1.3 -- -Copyright (c) 2006-2013 Paul Battley, Michael Neumann, Tim Fletcher. - -Copyright (c) 2004-2020 David Heinemeier Hansson - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - - ------ ** rb-fsevent; version 0.10.4 -- @@ -1472,6 +1440,7 @@ OTHER DEALINGS IN THE SOFTWARE. ------ ** dotenv; version 2.7.6 -- +Copyright (c) 2012 Brandon Keepers ** dotenv-rails; version 2.7.6 -- Copyright (c) 2012 Brandon Keepers @@ -1736,64 +1705,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------- - -** mimemagic; version 0.3.5 -- -Copyright 2007 Apple Inc. -COPYRIGHT BY SNK CORPORATION -(c) Alexandre PUKALL Avril 1998 -Copyright (c) 2011 Daniel Mendler - -The MIT License - -Copyright (c) 2011 Daniel Mendler - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - ------- - -** actioncable; version 6.1.3 -- -Copyright (c) 2010-2015 James Coglan - -Copyright (c) 2015-2020 Basecamp, LLC - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ------ ** money; version 6.13.8 -- @@ -2405,60 +2316,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------- - -** actionmailbox; version 6.1.3 -- - -MIT License - -Copyright (c) 2018-2020 Basecamp, LLC - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ------- - -** actiontext; version 6.1.3 -- - -MIT License - -Copyright (c) 2020 Basecamp, LLC - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ------ ** netrc; version 0.11.0 -- @@ -2486,6 +2343,32 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------ + +** nokogiri; version 1.11.2 -- +(c) Copyright 2002-2005, Andy Clark. +Copyright (c) 1998-2003 Daniel Veillard. +Copyright (c) 1998-2012 Daniel Veillard. +Copyright (c) 2001-2002 Daniel Veillard. +copyrighted by the Free Software Foundation +Copyright (c) 1991 Free Software Foundation, Inc. +Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler +Copyright (c) 2001-2003 Thai Open Source Software Center Ltd +Copyright (c) 2001-2002 Thomas Broyer, Charlie Bozeman and Daniel Veillard. +Copyright (c) 2001-2002, SourceForge ISO-RELAX Project (ASAMI Tomoharu, Daisuke Okajima, Kohsuke Kawaguchi, and MURATA Makoto) +Copyright 2008 2020 by Mike Dalessio, Aaron Patterson, Yoko Harada, Akinori MUSHA, John Shahid, Karol Bucek, Lars Kanis, Sergio Arbeo, Timothy Elliott, Nobuyoshi Nakada, Charles Nutter, Patrick Mahoney. + +The MIT License + +Copyright 2008 -- 2020 by Mike Dalessio, Aaron Patterson, Yoko Harada, Akinori MUSHA, John Shahid, Karol Bucek, Lars Kanis, Sergio Arbeo, Timothy Elliott, Nobuyoshi Nakada, Charles Nutter, Patrick Mahoney. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + ------ ** rspec-core; version 3.9.3 -- @@ -2668,33 +2551,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------- - -** activejob; version 6.1.3 -- - -Copyright (c) 2014-2020 David Heinemeier Hansson - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - - ------ ** parallel; version 1.20.1 -- @@ -2834,32 +2690,6 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------- - -** nokogiri; version 1.11.1 -- -(c) Copyright 2002-2005, Andy Clark. -Copyright (c) 1998-2003 Daniel Veillard. -Copyright (c) 1998-2012 Daniel Veillard. -Copyright (c) 2001-2002 Daniel Veillard. -copyrighted by the Free Software Foundation -Copyright (c) 1991 Free Software Foundation, Inc. -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2001-2003 Thai Open Source Software Center Ltd -Copyright (c) 2001-2002 Thomas Broyer, Charlie Bozeman and Daniel Veillard. -Copyright (c) 2001-2002, SourceForge ISO-RELAX Project (ASAMI Tomoharu, Daisuke Okajima, Kohsuke Kawaguchi, and MURATA Makoto) -Copyright 2008 2018 by Aaron Patterson, Mike Dalessio, Charles Nutter, Sergio Arbeo, Patrick Mahoney, Yoko Harada, Akinori MUSHA, John Shahid, Lars Kanis - -The MIT License - -Copyright 2008 -- 2018 by Aaron Patterson, Mike Dalessio, Charles Nutter, Sergio Arbeo, Patrick Mahoney, Yoko Harada, Akinori MUSHA, John Shahid, Lars Kanis - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ------ ** tilt; version 2.0.10 -- @@ -2945,8 +2775,17 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------ -** activerecord; version 6.1.3 -- -copyright (c) 2007-2016 Nick Kallen, Bryan Helmkamp, Emilio Tagua, Aaron Patterson +** actioncable; version 6.1.3.1 -- +** actionmailbox; version 6.1.3.1 -- +** actionmailer; version 6.1.3.1 -- +** actionpack; version 6.1.3.1 -- +** actiontext; version 6.1.3.1 -- +** actionview; version 6.1.3.1 -- +** activejob; version 6.1.3.1 -- +** activemodel; version 6.1.3.1 -- +** activerecord; version 6.1.3.1 -- +** activestorage; version 6.1.3.1 -- +** activesupport; version 6.1.3.1 -- ** coderay; version 1.1.3 -- Copyright (c) 2005-2012 Kornelius Kalnbach ** crack; version 0.4.5 -- @@ -2967,25 +2806,9 @@ Copyright (c) 2010-2015, The Dojo Foundation ** mime-types; version 3.3.1 -- Copyright 2003-2019 Austin Ziegler and contributors. ** mime-types-data; version 3.2020.1104 -- -** minitest; version 5.14.3 -- +** minitest; version 5.14.4 -- Copyright (c) Ryan Davis, seattle.rb -** nio4r; version 2.5.5 -- -(c) 2011 Emanuele Giaquinta -Copyright (c) 2011 Tony Arcieri. -Copyright, 2019, by Tony Arcieri. -Copyright (c) 2011-2017 Tony Arcieri. -Copyright, 2007-2019, by Marc Alexander Lehmann. -Copyright (c) 2019 Marc Alexander Lehmann -Copyright (c) 2007-2019 Marc Alexander Lehmann -Copyright (c) 2007,2008,2009 Marc Alexander Lehmann -Copyright (c) 2007,2008,2009,2010,2011,2012,2013 Marc Alexander Lehmann. -Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann -Copyright (c) 2007,2008,2009,2010,2011,2019 Marc Alexander Lehmann -Copyright, 2019, by Samuel G. D. Williams (http://www.codeotaku.com/samuel-williams). -Copyright (c) 2007,2008,2009,2010,2011,2016,2019 Marc Alexander Lehmann -Copyright (c) 2007,2008,2009,2010,2011,2012,2013,2019 Marc Alexander Lehmann -Copyright (c) 2007,2008,2009,2010,2011,2016,2017,2019 Marc Alexander Lehmann -Copyright (c) 2007,2008,2009,2010,2011,2012,2013,2016,2019 Marc Alexander Lehmann +** nio4r; version 2.5.7 -- ** qx; version 0.1.1 -- ** rack; version 2.2.3 -- Copyright (c) 2009-2018 Michael Fellinger @@ -2993,11 +2816,12 @@ Copyright (c) Django Software Foundation and individual contributors. Copyright (c) 2007-2019 Leah Neukirchen ** rack-attack; version 5.4.2 -- Copyright Kickstarter, PBC. -** rails; version 6.1.3 -- +** rails; version 6.1.3.1 -- ** rails-dom-testing; version 2.0.3 -- Copyright (c) 2013-2015 Kasper Timm Hansen ** rails-html-sanitizer; version 1.3.0 -- Copyright (c) 2013-2015 Rafael Mendonca Franca, Kasper Timm Hansen +** railties; version 6.1.3.1 -- ** wisper; version 2.0.1 -- Copyright (c) 2013 Kris Leech @@ -3011,32 +2835,6 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------- - -** activesupport; version 6.1.3 -- - -Copyright (c) 2005-2020 David Heinemeier Hansson - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ------ ** roadie; version 4.0.0 -- @@ -3120,7 +2918,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------ -** mini_mime; version 1.0.2 -- +** mini_mime; version 1.0.3 -- Copyright (c) 2016 Discourse Construction Kit, Inc. The MIT License (MIT) @@ -3399,32 +3197,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------- - -** activestorage; version 6.1.3 -- - -Copyright (c) 2017-2020 David Heinemeier Hansson, Basecamp - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ------ ** fast_blank; version 1.0.0 -- @@ -3763,33 +3535,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------- - -** marcel; version 0.3.3 -- -Copyright (c) 2017 Tom Ward - -Copyright (c) 2017 Tom Ward - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ------ ** table_print; version 1.5.7 -- @@ -4742,3 +4487,10 @@ See the file docs/artistic.txt in the main distribution. === GNU GPL version 2 See the file docs/COPYING.txt in the main distribution. + + +------ + +** marcel; version 1.0.0 -- + +MIT OR Apache-2.0 \ No newline at end of file diff --git a/app/models/nonprofit.rb b/app/models/nonprofit.rb index 072fde4b..06c188b1 100755 --- a/app/models/nonprofit.rb +++ b/app/models/nonprofit.rb @@ -99,9 +99,9 @@ class Nonprofit < ApplicationRecord validates :city, presence: true validates :state_code, presence: true validates_format_of :email, with: Email::Regex, allow_nil: true - validates_format_of :website, with: URI.regexp(['https', 'http']), allow_nil: true validates_presence_of :slug validates_uniqueness_of :slug, scope: %i[city_slug state_code_slug] + validates :website, url: { schemes: ['http', 'https'], public_suffix: true }, allow_nil: true validates_presence_of :user_id, on: :create, unless: -> {register_np_only} validate :user_is_valid, on: :create, unless: -> {register_np_only} diff --git a/spec/models/nonprofit_spec.rb b/spec/models/nonprofit_spec.rb index 09a78448..43d02709 100644 --- a/spec/models/nonprofit_spec.rb +++ b/spec/models/nonprofit_spec.rb @@ -86,7 +86,7 @@ RSpec.describe Nonprofit, type: :model do let(:nonprofit_with_same_name) { Nonprofit.new({name: "New Mexico Equality", state_code: nm_justice.state_code, city: nm_justice.city, user_id: user.id})} let(:nonprofit_with_same_name_but_different_state) { Nonprofit.new({name: "New Mexico Equality", state_code: 'mn', city: nm_justice.city, user_id: user.id })} - let(:nonprofit_with_bad_email_and_website) { Nonprofit.new({email: 'not_email', website: 'not_website'})} + let(:nonprofit_with_bad_email_and_website) { Nonprofit.new({email: 'not_email', website: 'not_website' })} let(:user) { create(:user)} let(:nonprofit_admin_role) do @@ -143,8 +143,9 @@ RSpec.describe Nonprofit, type: :model do expect(nonprofit_with_bad_email_and_website.errors['email'].first).to match /.*invalid.*/ end - it 'marks website as having errors if they do' do - expect(nonprofit_with_bad_email_and_website.errors['website'].first).to match /.*invalid.*/ + it 'marks website as having errors if they do' do + expect(nonprofit_with_bad_email_and_website.errors['website'].first) + .to match('is not a valid URL') end it 'marks an nonprofit as invalid when no slug could be created ' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e4b03541..bb2ea950 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,6 +19,7 @@ require 'support/mock_helpers' require 'action_mailer_matchers' require 'active_job' require 'wisper/rspec/matchers' +require 'validate_url/rspec_matcher' include ActiveJob::TestHelper RSpec.configure do |config| # rspec-expectations config goes here. You can use an alternate