Permalink
Browse files

Merge remote-tracking branch 'origin/capture-url-on-service-feedback'

  • Loading branch information...
2 parents a6eeeec + 50f1ea1 commit 84430d57a2eb2e5aaf2710593d2e7889ee9de040 @alext alext committed Jan 27, 2014
@@ -4,11 +4,12 @@ module Support
module Requests
module Anonymous
class ServiceFeedback < AnonymousContact
- attr_accessible :details, :slug, :service_satisfaction_rating
+ attr_accessible :details, :slug, :service_satisfaction_rating, :url
validates_presence_of :slug, :service_satisfaction_rating
validates :details, length: { maximum: 2 ** 16 }
validates_inclusion_of :service_satisfaction_rating, in: (1..5).to_a
+ validates :url, url: true, length: { maximum: 2048 }, allow_nil: true
end
end
end
@@ -10,6 +10,12 @@ class ServiceFeedbackTest < Test::Unit::TestCase
should validate_presence_of(:slug)
should ensure_inclusion_of(:service_satisfaction_rating).in_range(1..5)
+
+ should allow_value("https://www.gov.uk/something").for(:url)
+ should allow_value(nil).for(:url)
+ should allow_value("http://" + ("a" * 2040)).for(:url)
+ should_not allow_value("http://" + ("a" * 2050)).for(:url)
+ should_not allow_value("http://bla.example.org:9292/méh/fào?bar").for(:url)
end
end
end

0 comments on commit 84430d5

Please sign in to comment.