Commit ef7dfc4522d2945063d0bb9aa03fd8203077d796
1 parent
1da8268c
Exists in
master
and in
22 other branches
add unit testes to embed block support
Showing
2 changed files
with
12 additions
and
2 deletions
Show diff stats
app/models/block.rb
... | ... | @@ -16,12 +16,12 @@ class Block < ActiveRecord::Base |
16 | 16 | |
17 | 17 | named_scope :enabled, :conditions => { :enabled => true } |
18 | 18 | |
19 | - def embedable | |
19 | + def embedable? | |
20 | 20 | true |
21 | 21 | end |
22 | 22 | |
23 | 23 | def embed_code(url) |
24 | - html = "<iframe src='#{url}?source=SOURCE_NAME' frameborder='0' allowfullscreen ></iframe>" | |
24 | + html = "<iframe src='#{url}' frameborder='0'></iframe>" | |
25 | 25 | end |
26 | 26 | |
27 | 27 | # Determines whether a given block must be visible. Optionally a | ... | ... |
test/unit/block_test.rb
... | ... | @@ -222,4 +222,14 @@ class BlockTest < ActiveSupport::TestCase |
222 | 222 | assert block.visible?(2) |
223 | 223 | assert !block.visible?(3) |
224 | 224 | end |
225 | + | |
226 | + should 'be embedable by default' do | |
227 | + assert Block.new.embedable? | |
228 | + end | |
229 | + | |
230 | + should 'generate embed url' do | |
231 | + b = Block.new | |
232 | + assert_equal "<iframe src='http://myblogtest.com' frameborder='0'></iframe>", b.embed_code('http://myblogtest.com') | |
233 | + end | |
234 | + | |
225 | 235 | end | ... | ... |