require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb') describe JellyHelper 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(Object, :controller_path => 'my_fun_controller', :action_name => 'super_good_action') helper.should_receive(:controller).any_number_of_times.and_return(stub_controller) helper.should_receive(:form_authenticity_token).and_return('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('