require 'test_helper'
class MusiciansController < ApplicationController
end
class UrlHelperTest < MiniTest::Spec
let (:controller) { MusiciansController.new.tap { |ctl| ctl.send("request=", ActionDispatch::Request.new({})) } }
let (:cellule) { SongCell.new(controller) }
class SongCell < Cell::ViewModel
self.view_paths = ['test/fixtures']
include ActionView::Helpers::FormTagHelper
def edit
render
end
def with_content_tag
render
end
def with_block
render
end
def with_capture
render
end
def with_form_tag
form_tag("/songs") + content_tag(:span) + ""
end
include ActionView::Helpers::AssetTagHelper
def with_link_to
render
end
include ActionView::Helpers::FormHelper
def with_form_for_block
render
end
def erb_with_form_for_block
render template_engine: :erb
end
private
def cap
"yay, #{with_output_buffer { yield } }"
end
end
# URL helpers work in cell instance.
it { cellule.songs_path.must_equal "/songs" }
# it { cellule.url_for(Song.new).must_equal "/songs" }
include TestXml::Assertions # TODO: fix in test_xml.
# content_tag with HAML.
# it { cellule.with_content_tag.must_equal "Title:\n