Add tests: changing an arrow should respect prev change of other

Follow-up to PR #726.
This commit is contained in:
Jon Atack 2016-09-30 18:44:24 +02:00
parent 7ff4394782
commit 4c98866d5c
2 changed files with 36 additions and 0 deletions

View File

@ -92,6 +92,24 @@ module Ransack
Ransack.options = before
end
it 'changes one arrow while respecting the other customized arrow' do
before = Ransack.options.clone
Ransack.configure { |c| c.custom_arrows = { up_arrow: 'up' } }
expect(Ransack.options[:down_arrow]).to eq before[:down_arrow]
Ransack.configure { |c| c.custom_arrows = { down_arrow: 'DOWN' } }
expect(Ransack.options[:up_arrow]).to eq 'up'
Ransack.configure { |c| c.custom_arrows = { up_arrow: '<i>U-Arrow</i>' } }
expect(Ransack.options[:down_arrow]).to eq 'DOWN'
Ransack.configure { |c| c.custom_arrows = { down_arrow: 'down arrow-2' } }
expect(Ransack.options[:up_arrow]).to eq '<i>U-Arrow</i>'
Ransack.options = before
end
it 'adds predicates that take arrays, overriding compounds' do
Ransack.configure do |config|
config.add_predicate(

View File

@ -92,6 +92,24 @@ module Ransack
Ransack.options = before
end
it 'changes one arrow while respecting the other customized arrow' do
before = Ransack.options.clone
Ransack.configure { |c| c.custom_arrows = { up_arrow: 'up' } }
expect(Ransack.options[:down_arrow]).to eq before[:down_arrow]
Ransack.configure { |c| c.custom_arrows = { down_arrow: 'DOWN' } }
expect(Ransack.options[:up_arrow]).to eq 'up'
Ransack.configure { |c| c.custom_arrows = { up_arrow: '<i>U-Arrow</i>' } }
expect(Ransack.options[:down_arrow]).to eq 'DOWN'
Ransack.configure { |c| c.custom_arrows = { down_arrow: 'down arrow-2' } }
expect(Ransack.options[:up_arrow]).to eq '<i>U-Arrow</i>'
Ransack.options = before
end
it 'adds predicates that take arrays, overriding compounds' do
Ransack.configure do |config|
config.add_predicate(