http://github.com/kristianmandrup/rspec-action_view
---
require 'spec_helper'
module MyView
module Tab
def tab_for(clazz, &block)
content = with_output_buffer(&block)
content_tag :li, content, :class => clazz
end
end
module Say
def hello(clazz, &block)
content = with_output_buffer(&block)
content_tag :div, content, :class => clazz
end
def name
'Kristian'
end
end
end
describe 'My View extensions' do
# extend ActionView::Base with custom helper modules
extend_view_with MyView, :tab, :say
it "should do the magic!!!" do
with_engine(:erb) do |e|
e.run_template("hello <%= name %>").should match /Kristian/
e.run_template do
%{<%= tab_for :x do %>
<%= hello :blip do %>
ged
<% end %>
<% end %>}
end.should match /ged/
end
end
end
on 2010-08-25 20:58
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.