1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
describe "Generating FBML" do
  include ActionView::Helpers::TagHelper
  include FacebookHelper
  
  def capture
    yield
  end
  
  def concat(str, binding)
    str
  end
  
  it "should create an empty element when no block is passed" do
    fb_name(:uid => 123).should == '<fb:name uid="123" />'
  end
  
  it "should create an element with contents when passing a block" do
    fb_if_can_see(:uid => 123) { 'BOO!' }.should == '<fb:if-can-see uid="123">BOO!</fb:if-can-see>'
  end
  
  it "should raise an exception when passing an invalid attribute" do
    proc { fb_name(:bad => 'attribute') }.should raise_error
  end
end