spec/unit/icon_spec.rb in prawn-icon-0.6.1 vs spec/unit/icon_spec.rb in prawn-icon-0.6.2
- old
+ new
@@ -40,9 +40,29 @@
expect(proc).to raise_error(ArgumentError)
end
end
end
+ describe '#format_hash' do
+ it 'should add :font and :content keys' do
+ pdf = create_pdf
+ icon = Prawn::Icon.new 'fa-arrows', pdf
+ hash = icon.format_hash
+
+ expect(hash[:font]).to eq('fa')
+ expect(hash[:content]).to eq("\uf047")
+ end
+
+ it 'should rename key :color to :text_color' do
+ pdf = create_pdf
+ icon = Prawn::Icon.new 'fa-arrows', pdf, color: '0099ff'
+ hash = icon.format_hash
+
+ expect(hash[:color]).to be_nil
+ expect(hash[:text_color]).to eq('0099ff')
+ end
+ end
+
describe '#render' do
it 'should render an icon to the page' do
pdf = create_pdf
pdf.icon('fa-arrows').render
text = PDF::Inspector::Text.analyze(pdf.render)
\ No newline at end of file