Created
December 17, 2011 01:20
-
-
Save batasrki/1488779 to your computer and use it in GitHub Desktop.
Is this evil?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe Something do | |
before do | |
@mock_view = mock("rails view") | |
proc_thing = @mock_view.stub(:content_tag).with(:span).and_return("<span></span>") | |
@mock_view.stub(:content_tag).with(:div).and_yield.and_return("<div>#{proc_thing.call}</div>") | |
end | |
it "should return a span inside a div" do | |
Something.new(@mock_view).render_custom_block.should match /\<div\>\<span\>\<\\span\>\<\\div\>/ | |
end | |
end | |
class Something | |
def initialize(view) | |
@view = view | |
end | |
def render_custom_block | |
@view.content_tag :div do | |
@view.content_tag :span | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment