Sha256: b795d91cd8a69069a7e5544e05be4620b1463d2517236357b5724e149a946c56
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
require 'spec_helper' require 'action_controller' RSpec.describe Hikari::ViewHelpers::ActionView do it 'should be loaded into ActionView' do ActionView::Base.send(:include, Hikari::ViewHelpers::ActionView) av = ActionView::Base.new expect(av).to respond_to(:link_to_sorted) end end RSpec.describe Hikari::ViewHelpers::ActionView::HikariViewHelper do it 'should default to asc' do field = :title view_helper = Hikari::ViewHelpers::ActionView::HikariViewHelper.new field, {} expect(view_helper.params).to eq({sort: 'title_asc'}) end it 'should set desc when given' do field = {title: :desc} view_helper = Hikari::ViewHelpers::ActionView::HikariViewHelper.new field, {} expect(view_helper.params).to eq({sort: 'title_desc'}) end it 'should add swap sort order' do field = :title params = ActionController::Parameters.new(sort: "title_asc") view_helper = Hikari::ViewHelpers::ActionView::HikariViewHelper.new field, params expect(view_helper.params).to eq({'sort' => 'title_desc'}) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hikari-0.5.0 | spec/lib/action_view_spec.rb |