spec/unit/base_spec.rb in prawn-icon-2.5.0 vs spec/unit/base_spec.rb in prawn-icon-3.0.0
- old
+ new
@@ -2,14 +2,33 @@
#
# Copyright September 2016, Jesse Doyle. All rights reserved.
#
# This is free software. Please see the LICENSE and COPYING files for details.
-describe Prawn::Icon::Base do
- describe 'FONTDIR' do
- it 'returns the data/fonts directory' do
- path = File.expand_path '../../..', __FILE__
- path = File.join path, 'data/fonts'
- expect(Prawn::Icon::Base::FONTDIR).to eq(path)
+describe Prawn::Icon do
+ describe '#configuration' do
+ it 'returns an instance of Prawn::Icon::Configuration' do
+ expect(described_class.configuration).to be_a(Prawn::Icon::Configuration)
+ end
+ end
+
+ describe '#configure' do
+ around(:each) do |example|
+ old = described_class.configuration.dup
+ described_class.configure do |config|
+ config.font_directory = '/tmp/fonts'
+ end
+ example.run
+ described_class.configuration = old
+ end
+
+ it 'yields control' do
+ expect { |b| described_class.configure(&b) }.to yield_control
+ end
+
+ it 'configures properties' do
+ expect(described_class.configuration.font_directory).to eq(
+ Pathname.new('/tmp/fonts')
+ )
end
end
end