Skip to content

Instantly share code, notes, and snippets.

@terlar
Created February 26, 2015 09:19
Show Gist options
  • Save terlar/60c41c513b7ea95a2176 to your computer and use it in GitHub Desktop.
Save terlar/60c41c513b7ea95a2176 to your computer and use it in GitHub Desktop.
require_relative '../../../web_test_helper'
module Web
class PostAdWithDescriptionPropertyTest < PostAdTestCase
def test_post_ad_with_multiline_description
description = "This is a multiline\ndescription\nindeed it is\n"
post_ad_with_properties({
key: 'description',
type: 'description',
value: description
})
assert_description(last_response, {
label: 'Description',
value: description
})
get "/ads/#{last_posted_ad_id}" do |response|
assert_description(response, {
label: 'Description',
value: description
})
end
end
private
def assert_description(response, data)
json = JSON.load(response.body).fetch('ad')
assert json.fetch('description'), data
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment