require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'mitamirri' include Mitamirri::Helper describe "application helper methods" do describe 'track action' do it 'creates a trackable action object from view tracking invocation' do request = Object.new request.stubs(:referrer).returns('/') request.stubs(:remote_ip).returns('123.123.123.123') request.stubs(:url).returns('http://www.elizium.com/opiates') session = Object.new session.stubs(:session_id).returns('1234ab') lambda{ track_action('view', :label => 'Some Label') }.should change(TrackableAction, :count).by(1) end it 'returns track click code for click tracking invocation' do request = Object.new request.stubs(:referrer).returns('/') request.stubs(:remote_ip).returns('123.123.123.123') request.stubs(:url).returns('http://www.elizium.com/opiates') session = Object.new session.stubs(:session_id).returns('1234ab') track_action('click').should_not be_nil end it 'needs more robust tests for this method' end it 'returns appropriate track_click_code' do expected = %{} track_event_code('click', 'mousedown', 'my_button', 'my_action', '/', '123.123.123.123', 'www.seologic.com', '/', 'asdf').should == expected end it 'returns a legend tag' do legend_tag('Foo', {:id => 'foo'}).should == %{
Foo
\r} end it 'returns page break code' do page_break.should == %{

(Continued on next page)

} end end