From 28dc9d1f5ff0f5738b0e11815e2f6e1d11ccd1ae Mon Sep 17 00:00:00 2001 From: Garett Arrowood Date: Tue, 27 Sep 2016 16:54:58 -0400 Subject: [PATCH] Add custom_arrows tests to form_helper_spec --- spec/ransack/helpers/form_helper_spec.rb | 46 ++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/spec/ransack/helpers/form_helper_spec.rb b/spec/ransack/helpers/form_helper_spec.rb index ea82e2d..8a56dcc 100644 --- a/spec/ransack/helpers/form_helper_spec.rb +++ b/spec/ransack/helpers/form_helper_spec.rb @@ -649,6 +649,52 @@ module Ransack it { should match /Full Name ▼/ } end + describe '#sort_link with config set with custom up_arrow' do + before do + Ransack.configure do |c| + c.custom_arrows = { up_arrow: "\u{1F446}" } + end + end + after do + #set back to default + Ransack.configure do |c| + c.custom_arrows = { up_arrow: "▼" } + end + end + subject { @controller.view_context + .sort_link( + [:main_app, Person.search(sorts: ['name desc'])], + :name, + controller: 'people', + hide_indicator: false + ) + } + it { should match /Full Name \u{1F446}/ } + end + + describe '#sort_link with config set with custom down_arrow' do + before do + Ransack.configure do |c| + c.custom_arrows = { down_arrow: "\u{1F447}" } + end + end + after do + #set back to default + Ransack.configure do |c| + c.custom_arrows = { down_arrow: "▲" } + end + end + subject { @controller.view_context + .sort_link( + [:main_app, Person.search(sorts: ['name asc'])], + :name, + controller: 'people', + hide_indicator: false + ) + } + it { should match /Full Name \u{1F447}/ } + end + describe '#sort_link with config set to globally hide order indicators' do before do Ransack.configure { |c| c.hide_sort_order_indicators = true }