Skip to content

Commit

Permalink
Minor tests cleanup from PR #726
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatack committed Sep 29, 2016
1 parent a5be55b commit f73dd6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
13 changes: 4 additions & 9 deletions spec/mongoid/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,16 @@ module Ransack
end

it 'changes default arrow strings' do
# store original state so we can restore it later
before = Ransack.options.clone
up_value, down_value = '<i class="fa fa-long-arrow-up"></i>', 'U+02193'

Ransack.configure do |config|
config.custom_arrows = {
up_arrow: '<i class="fa fa-long-arrow-up"></i>',
down_arrow: 'U+02193'
}
config.custom_arrows = { up_arrow: up_value, down_arrow: down_value }
end

expect(Ransack.options[:up_arrow])
.to eq '<i class="fa fa-long-arrow-up"></i>'
expect(Ransack.options[:down_arrow]).to eq 'U+02193'
expect(Ransack.options[:up_arrow]).to eq up_value
expect(Ransack.options[:down_arrow]).to eq down_value

# restore original state so we don't break other tests
Ransack.options = before
end

Expand Down
17 changes: 5 additions & 12 deletions spec/ransack/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
module Ransack
describe Configuration do
it 'yields Ransack on configure' do
Ransack.configure do |config|
expect(config).to eq Ransack
end
Ransack.configure { |config| expect(config).to eq Ransack }
end

it 'adds predicates' do
Expand Down Expand Up @@ -57,21 +55,16 @@ module Ransack
end

it 'changes default arrow strings' do
# store original state so we can restore it later
before = Ransack.options.clone
up_value, down_value = '<i class="fa fa-long-arrow-up"></i>', 'U+02193'

Ransack.configure do |config|
config.custom_arrows = {
up_arrow: '<i class="fa fa-long-arrow-up"></i>',
down_arrow: 'U+02193'
}
config.custom_arrows = { up_arrow: up_value, down_arrow: down_value }
end

expect(Ransack.options[:up_arrow])
.to eq '<i class="fa fa-long-arrow-up"></i>'
expect(Ransack.options[:down_arrow]).to eq 'U+02193'
expect(Ransack.options[:up_arrow]).to eq up_value
expect(Ransack.options[:down_arrow]).to eq down_value

# restore original state so we don't break other tests
Ransack.options = before
end

Expand Down

0 comments on commit f73dd6a

Please sign in to comment.