Sha256: 67d0454eb948289c69064f2c1fa8e60c65dcf5ba63af641070079cf1af5ce5f5
Contents?: true
Size: 1.49 KB
Versions: 3
Compression:
Stored size: 1.49 KB
Contents
require File.dirname(__FILE__) + '/../../test_helper' class ApplicationHelperTest < HelperTestCase include ApplicationHelper context 'sortable_table_header' do setup do self.stubs(:params).returns({ :controller => :jobs, :action => :index, :sort => nil, :order => nil }) end [:name, :sort].each do |param| should "raise an error without default param #{param}" do opts = { :name => 'name', :sort => 'sort' } opts.delete param assert_raise(ArgumentError) do sortable_table_header opts end end end context 'with no params[:sort] or params[:order]' do setup do @html = sortable_table_header(:name => 'Title', :sort => 'title', :title => 'Sort by title') end should 'return a table header without a class attribute' do assert @html.include?('<th>') end end context "without an :anchor" do setup do @html = sortable_table_header(:name => 'Title', :sort => 'title', :title => 'Sort by title') end should 'return a link that contains a url with no anchor' do assert @html.match(/href="[^#]+?"/) end end context "with an :anchor" do setup do @html = sortable_table_header(:name => 'Title', :sort => 'title', :title => 'Sort by title', :anchor => 'search-results') end should 'return a link that contains a url with that anchor' do assert @html.match(/href="[^"]*?#search-results"/) end end end end
Version data entries
3 entries across 3 versions & 2 rubygems