Skip to content

Commit

Permalink
Add custom_arrows tests to form_helper_spec
Browse files Browse the repository at this point in the history
  • Loading branch information
garettarrowood committed Sep 27, 2016
1 parent 208a222 commit 28dc9d1
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions spec/ransack/helpers/form_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,52 @@ module Helpers
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 }
Expand Down

0 comments on commit 28dc9d1

Please sign in to comment.