require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb') describe JellyHelper, :type => :helper do def jelly_attach_arguments(html) JSON.parse(Regexp.new('Jelly\.attach\.apply\(Jelly, (.*)\);').match(html)[1]) end describe "#spread_jelly" do before do stub_controller = mock! do |controller| controller.controller_path {'my_fun_controller'} controller.action_name {'super_good_action'} end stub(helper).controller {stub_controller} mock(helper).form_authenticity_token {'areallysecuretoken'} end it "should create a javascript include tag that attaches the Jelly.Location and Jelly.Page components" do output = helper.spread_jelly output.should include('