Putting together a global set method for defaults

This commit is contained in:
Andy Meneely
2014-07-28 16:01:46 -04:00
parent 50c4da8e1a
commit 10890be8a1
6 changed files with 57 additions and 14 deletions
+37
View File
@@ -0,0 +1,37 @@
require 'spec_helper'
require 'squib'
describe Squib::Deck, '#text' do
context "when working with fonts" do
it"should use the default font when #text and #set_font don't specify" do
card = instance_double(Squib::Card)
expect(card).to receive(:text).with('a', Squib::SYSTEM_DEFAULTS[:font], anything, anything, anything, anything).once
Squib::Deck.new do
@cards = [card]
text str: 'a'
end
end
it "should use the #set_font when #text doesn't specify" do
card = instance_double(Squib::Card)
expect(card).to receive(:text).with('a', 'Times New Roman 16', anything, anything, anything, anything).once
Squib::Deck.new do
@cards = [card]
set font: 'Times New Roman 16'
text str: 'a'
end
end
it "should use the specified font no matter what" do
card = instance_double(Squib::Card)
expect(card).to receive(:text).with('a', 'Arial 18', anything, anything, anything, anything).once
Squib::Deck.new do
@cards = [card]
set font: 'Times New Roman 16'
text str: 'a', font: 'Arial 18'
end
end
end
end