Sha256: 289dc483a1f37f9a87ee4536bf78c7fb3335a893dd87918b0f3c019010b81fb7
Contents?: true
Size: 1.53 KB
Versions: 3
Compression:
Stored size: 1.53 KB
Contents
require "spec_helper" describe AjaxPagination::HelperAdditions do module BlockPassThrough def content_tag(name, options = {}) yield end end before :each do @view_class = Class.new @view = @view_class.new @view.stub!(:count).and_return(0,1,2,3,4,5,6,7) # detects how many times the method is called @view_class.send(:include, AjaxPagination::HelperAdditions) @view_class.send(:include, BlockPassThrough) # passes through block return value directly end describe 'ajax_pagination' do it 'should render partial requested, default of page with no arguments' do @view.should_receive(:render).with('page') @view.ajax_pagination @view.should_receive(:render).with('page2') @view.ajax_pagination :pagination => 'page2' # renders the partial named :pagination if :partial not defined @view.should_receive(:render).with('page3') @view.ajax_pagination :render => 'page3' # if partial defined, renders partial @view.should_receive(:render).with('pageX') @view.ajax_pagination :pagination => 'page10', :render => 'pageX' # even if pagination also defined as different value end end describe 'ajax_pagination_loadzone' do it 'should yield once to block' do html = @view.ajax_pagination_loadzone do @view.count true end html.should be_true @view.count.should == 1 html = @view.ajax_pagination_loadzone do @view.count false end html.should be_false @view.count.should == 3 end end end
Version data entries
3 entries across 3 versions & 1 rubygems