Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/capture-url-on-service-feedback'
Browse files Browse the repository at this point in the history
  • Loading branch information
alext committed Jan 27, 2014
2 parents a6eeeec + 50f1ea1 commit 84430d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/support/requests/anonymous/service_feedback.rb
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions test/unit/support/requests/anonymous/service_feedback_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit 84430d5

Please sign in to comment.