Sha256: 3aa553fe4925718fd8f09d38f2fc3ac4505b2d5f852399cef55727bc1f681ae1
Contents?: true
Size: 845 Bytes
Versions: 1
Compression:
Stored size: 845 Bytes
Contents
require 'spec_helper' require 'sorting_helper' describe ApplicationController, type: [:controller, :request] do describe '#sorting_column' do it 'returns column name without direction prefix' do controller.params[:sort] = '-column' expect(controller.sorting_column).to eq('column') end it 'returns nil if sort is not specified' do expect(controller.sorting_column).to eq(nil) end end describe '#sorting_direction' do it 'returns direction type based on column prefix' do controller.params[:sort] = '-column' expect(controller.sorting_direction).to eq(:desc) controller.params[:sort] = 'column' expect(controller.sorting_direction).to eq(:asc) end it 'returns nil if sort is not specified' do expect(controller.sorting_direction).to eq(nil) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sorting_helper-0.1.0 | spec/controllers/application_controller_spec.rb |