Fix post iframe src url

Add test for posts helper
This commit is contained in:
Liane Nakamura 2013-05-24 20:23:29 -07:00 committed by Jonne Haß
parent cae70d8194
commit 5f25a52676
3 changed files with 23 additions and 1 deletions

View file

@ -11,6 +11,7 @@
* Don't error out in script/server if git is unavailable.
* Fix post preview from tag pages [#4157](https://github.com/diaspora/diaspora/issues/4157)
* Fix tags ordering in chrome [#4133](https://github.com/diaspora/diaspora/issues/4133)
* Fix src URL for oEmbed iFrame [#4178](https://github.com/diaspora/diaspora/pull/4178)
## Features

View file

@ -20,7 +20,7 @@ module PostsHelper
def post_iframe_url(post_id, opts={})
opts[:width] ||= 516
opts[:height] ||= 315
host = AppConfig.pod_uri.site
host = AppConfig.pod_uri.authority
"<iframe src='#{Rails.application.routes.url_helpers.post_url(post_id, :host => host)}' width='#{opts[:width]}px' height='#{opts[:height]}px' frameBorder='0'></iframe>".html_safe
end
end

View file

@ -0,0 +1,21 @@
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe PostsHelper do
describe '#post_iframe_url' do
before do
@post = FactoryGirl.create(:status_message)
end
it "returns an iframe tag" do
post_iframe_url(@post.id).should include "iframe"
end
it "returns an iframe containing the post" do
post_iframe_url(@post.id).should include "src='http://localhost:9887#{post_path(@post)}'"
end
end
end