What changed in Ruby? -


the following spec passes fine in ruby 2.1.5 fails in 2.2.0 , can't tell that's about:

# job.rb  class job < activerecord::base   validates :link, :url => true end  # job_spec.rb  require 'rails_helper'  describe job    describe "#create"     ["blah", "http://", " "].each |bad_link|       {         should_not allow_value(bad_link).for(:link)       }     end   end end 

fail log looks this:

1) job#create should not allow link set "http://"      failure/error: should_not allow_value(bad_link).for(:link)        expected errors when link set "http://",        got no errors      # ./spec/models/job_spec.rb:14:in `block (4 levels) in <top (required)>' 

i find way spec pass ruby 2.2.0 include validates_url gem in project!!

does know about?

maybe solution isn't ideal, works.

replace validates_url gem validates gem. has urlvalidator (written me), tested.

gem 'validates' # in gemfile validates :link, :url => true # needn't change something. remove validates_url gemfile 

p.s. it's strange way - test functionality of gem. functionality should tested in gem already.

p.p.s. i'm recommend move ruby 2.2.1 (or 2.2.2) instead of 2.2.0, because of 2.2.0 has lot of bugs


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -