Rubocop: Trailing Whitespace
This commit is contained in:
@@ -6,22 +6,22 @@ describe Squib::Deck, '#text' do
|
||||
context "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', 'Arial 36',
|
||||
expect(card).to receive(:text).with('a', 'Arial 36',
|
||||
anything, anything, anything,anything,anything,anything, anything, anything, anything,anything, anything, anything, anything, anything, anything
|
||||
).once
|
||||
Squib::Deck.new do
|
||||
@cards = [card]
|
||||
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',
|
||||
expect(card).to receive(:text).with('a', 'Times New Roman 16',
|
||||
anything, anything, anything, anything,anything,anything, anything, anything, anything,anything, anything, anything, anything, anything, anything
|
||||
).once
|
||||
Squib::Deck.new do
|
||||
@cards = [card]
|
||||
Squib::Deck.new do
|
||||
@cards = [card]
|
||||
set font: 'Times New Roman 16'
|
||||
text str: 'a'
|
||||
end
|
||||
@@ -29,11 +29,11 @@ describe Squib::Deck, '#text' do
|
||||
|
||||
it "should use the specified font no matter what" do
|
||||
card = instance_double(Squib::Card)
|
||||
expect(card).to receive(:text).with('a', 'Arial 18',
|
||||
expect(card).to receive(:text).with('a', 'Arial 18',
|
||||
anything, anything, anything, anything,anything,anything,anything, anything, anything,anything, anything, anything, anything, anything, anything
|
||||
).once
|
||||
Squib::Deck.new do
|
||||
@cards = [card]
|
||||
Squib::Deck.new do
|
||||
@cards = [card]
|
||||
set font: 'Times New Roman 16'
|
||||
text str: 'a', font: 'Arial 18'
|
||||
end
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
require 'spec_helper'
|
||||
require 'squib'
|
||||
|
||||
describe Squib::Commands::New do
|
||||
describe Squib::Commands::New do
|
||||
|
||||
describe "#process" do
|
||||
describe "#process" do
|
||||
before(:all) do
|
||||
@old_stderr = $stderr
|
||||
$stderr = StringIO.new
|
||||
@@ -44,5 +44,5 @@ describe Squib::Commands::New do
|
||||
Dir.chdir(@oldpwd)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
a:
|
||||
a:
|
||||
extends: b
|
||||
x: 50
|
||||
b:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
a:
|
||||
a:
|
||||
extends: c
|
||||
x: 50
|
||||
b:
|
||||
extends: a
|
||||
x: 150
|
||||
c:
|
||||
c:
|
||||
extends: b
|
||||
y: 250
|
||||
@@ -1,13 +1,13 @@
|
||||
aunt:
|
||||
aunt:
|
||||
a: 101
|
||||
b: 102
|
||||
c: 103
|
||||
uncle:
|
||||
uncle:
|
||||
x: 104
|
||||
y: 105
|
||||
b: 106
|
||||
child:
|
||||
extends:
|
||||
extends:
|
||||
- uncle
|
||||
- aunt
|
||||
a: 107
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
frame:
|
||||
frame:
|
||||
x: 38
|
||||
y: 38
|
||||
title:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
frame:
|
||||
frame:
|
||||
x: 38
|
||||
valign: !ruby/symbol middle
|
||||
valign: !ruby/symbol middle
|
||||
str: "blah"
|
||||
font: Mr. Font
|
||||
|
||||
@@ -2,6 +2,6 @@ title:
|
||||
extends: frame
|
||||
y: 50
|
||||
width: 100
|
||||
frame:
|
||||
frame:
|
||||
x: 38
|
||||
y: 38
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
a:
|
||||
a:
|
||||
extends: a
|
||||
x: 50
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
frame:
|
||||
frame:
|
||||
x: 38
|
||||
y: 38
|
||||
title:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
frame:
|
||||
frame:
|
||||
x: 38
|
||||
y: 38
|
||||
title:
|
||||
|
||||
+42
-42
@@ -1,10 +1,10 @@
|
||||
require 'spec_helper'
|
||||
require 'squib/deck'
|
||||
|
||||
describe Squib::Deck do
|
||||
describe Squib::Deck do
|
||||
|
||||
it "initializes with default parameters" do
|
||||
d = Squib::Deck.new
|
||||
d = Squib::Deck.new
|
||||
expect(d.width).to eq(825)
|
||||
expect(d.height).to eq(1125)
|
||||
expect(d.cards.size).to eq(1)
|
||||
@@ -13,11 +13,11 @@ describe Squib::Deck do
|
||||
context "in dealing with ranges" do
|
||||
it "calls text on all cards by default" do
|
||||
card1 = instance_double(Squib::Card)
|
||||
card2 = instance_double(Squib::Card)
|
||||
card2 = instance_double(Squib::Card)
|
||||
expect(card1).to receive(:text).once
|
||||
expect(card2).to receive(:text).once
|
||||
Squib::Deck.new do
|
||||
@cards = [card1, card2]
|
||||
Squib::Deck.new do
|
||||
@cards = [card1, card2]
|
||||
text str: 'blah'
|
||||
end
|
||||
end
|
||||
@@ -26,11 +26,11 @@ describe Squib::Deck do
|
||||
card1 = instance_double(Squib::Card)
|
||||
card2 = instance_double(Squib::Card)
|
||||
expect(card2).to receive(:text).once
|
||||
Squib::Deck.new do
|
||||
@cards = [card1, card2]
|
||||
Squib::Deck.new do
|
||||
@cards = [card1, card2]
|
||||
text range: 1, str: 'blah'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "calls text with ranges" do
|
||||
card1 = instance_double(Squib::Card)
|
||||
@@ -38,8 +38,8 @@ describe Squib::Deck do
|
||||
card3 = instance_double(Squib::Card)
|
||||
expect(card1).to receive(:text).once
|
||||
expect(card2).to receive(:text).once
|
||||
Squib::Deck.new do
|
||||
@cards = [card1, card2, card3]
|
||||
Squib::Deck.new do
|
||||
@cards = [card1, card2, card3]
|
||||
text range: 0..1, str: 'blah'
|
||||
end
|
||||
end
|
||||
@@ -48,10 +48,10 @@ describe Squib::Deck do
|
||||
context "#load_layout" do
|
||||
|
||||
it "loads a normal layout with no extends" do
|
||||
d = Squib::Deck.new(layout: test_file('no-extends.yml'))
|
||||
d = Squib::Deck.new(layout: test_file('no-extends.yml'))
|
||||
expect(d.layout).to \
|
||||
eq({'frame' => {
|
||||
'x' => 38,
|
||||
'x' => 38,
|
||||
'valign' => :middle,
|
||||
'str' => "blah",
|
||||
'font' => "Mr. Font",
|
||||
@@ -61,16 +61,16 @@ describe Squib::Deck do
|
||||
end
|
||||
|
||||
it "loads with a single extends" do
|
||||
d = Squib::Deck.new(layout: test_file('single-extends.yml'))
|
||||
d = Squib::Deck.new(layout: test_file('single-extends.yml'))
|
||||
expect(d.layout).to \
|
||||
eq({'frame' => {
|
||||
'x' => 38,
|
||||
'y' => 38,
|
||||
'x' => 38,
|
||||
'y' => 38,
|
||||
},
|
||||
'title' => {
|
||||
'extends' => 'frame',
|
||||
'x' => 38,
|
||||
'y' => 50,
|
||||
'x' => 38,
|
||||
'y' => 50,
|
||||
'width' => 100,
|
||||
}
|
||||
}
|
||||
@@ -78,16 +78,16 @@ describe Squib::Deck do
|
||||
end
|
||||
|
||||
it "applies the extends regardless of order" do
|
||||
d = Squib::Deck.new(layout: test_file('pre-extends.yml'))
|
||||
d = Squib::Deck.new(layout: test_file('pre-extends.yml'))
|
||||
expect(d.layout).to \
|
||||
eq({'frame' => {
|
||||
'x' => 38,
|
||||
'y' => 38,
|
||||
'x' => 38,
|
||||
'y' => 38,
|
||||
},
|
||||
'title' => {
|
||||
'extends' => 'frame',
|
||||
'x' => 38,
|
||||
'y' => 50,
|
||||
'x' => 38,
|
||||
'y' => 50,
|
||||
'width' => 100,
|
||||
}
|
||||
}
|
||||
@@ -95,22 +95,22 @@ describe Squib::Deck do
|
||||
end
|
||||
|
||||
it "applies the single-level extends multiple times" do
|
||||
d = Squib::Deck.new(layout: test_file('single-level-multi-extends.yml'))
|
||||
d = Squib::Deck.new(layout: test_file('single-level-multi-extends.yml'))
|
||||
expect(d.layout).to \
|
||||
eq({'frame' => {
|
||||
'x' => 38,
|
||||
'y' => 38,
|
||||
'x' => 38,
|
||||
'y' => 38,
|
||||
},
|
||||
'title' => {
|
||||
'extends' => 'frame',
|
||||
'x' => 38,
|
||||
'y' => 50,
|
||||
'x' => 38,
|
||||
'y' => 50,
|
||||
'width' => 100,
|
||||
},
|
||||
'title2' => {
|
||||
'extends' => 'frame',
|
||||
'x' => 75,
|
||||
'y' => 150,
|
||||
'x' => 75,
|
||||
'y' => 150,
|
||||
'width' => 150,
|
||||
},
|
||||
}
|
||||
@@ -118,17 +118,17 @@ describe Squib::Deck do
|
||||
end
|
||||
|
||||
it "applies multiple extends in a single rule" do
|
||||
d = Squib::Deck.new(layout: test_file('multi-extends-single-entry.yml'))
|
||||
d = Squib::Deck.new(layout: test_file('multi-extends-single-entry.yml'))
|
||||
expect(d.layout).to \
|
||||
eq({'aunt' => {
|
||||
'a' => 101,
|
||||
'b' => 102,
|
||||
'c' => 103,
|
||||
'a' => 101,
|
||||
'b' => 102,
|
||||
'c' => 103,
|
||||
},
|
||||
'uncle' => {
|
||||
'x' => 104,
|
||||
'y' => 105,
|
||||
'b' => 106,
|
||||
'x' => 104,
|
||||
'y' => 105,
|
||||
'b' => 106,
|
||||
},
|
||||
'child' => {
|
||||
'extends' => ['uncle','aunt'],
|
||||
@@ -143,22 +143,22 @@ describe Squib::Deck do
|
||||
end
|
||||
|
||||
it "applies multi-level extends" do
|
||||
d = Squib::Deck.new(layout: test_file('multi-level-extends.yml'))
|
||||
d = Squib::Deck.new(layout: test_file('multi-level-extends.yml'))
|
||||
expect(d.layout).to \
|
||||
eq({'frame' => {
|
||||
'x' => 38,
|
||||
'y' => 38,
|
||||
'x' => 38,
|
||||
'y' => 38,
|
||||
},
|
||||
'title' => {
|
||||
'extends' => 'frame',
|
||||
'x' => 38,
|
||||
'y' => 50,
|
||||
'x' => 38,
|
||||
'y' => 50,
|
||||
'width' => 100,
|
||||
},
|
||||
'subtitle' => {
|
||||
'extends' => 'title',
|
||||
'x' => 38,
|
||||
'y' => 150,
|
||||
'y' => 150,
|
||||
'width' => 100,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ describe Squib::InputHelpers do
|
||||
before(:each) do
|
||||
@deck = DummyDeck.new
|
||||
@deck.layout = {
|
||||
'blah' => {x: 25},
|
||||
'blah' => {x: 25},
|
||||
'apples' => {x: 35},
|
||||
'oranges' => {y: 45},
|
||||
}
|
||||
@@ -33,29 +33,29 @@ describe Squib::InputHelpers do
|
||||
Squib.logger = instance_double(Logger)
|
||||
expect(Squib.logger).to receive(:warn).with("Layout entry 'foo' does not exist.").twice
|
||||
expect(Squib.logger).to receive(:debug)
|
||||
expect(@deck.send(:layoutify, {layout: :foo})).to eq({layout: [:foo,:foo]})
|
||||
expect(@deck.send(:layoutify, {layout: :foo})).to eq({layout: [:foo,:foo]})
|
||||
Squib.logger = @old_logger
|
||||
end
|
||||
|
||||
it "applies the layout in a normal situation" do
|
||||
expect(@deck.send(:layoutify, {layout: :blah})).to \
|
||||
eq({layout: [:blah, :blah], x: [25, 25]})
|
||||
eq({layout: [:blah, :blah], x: [25, 25]})
|
||||
end
|
||||
|
||||
it "applies two different layouts for two different situations" do
|
||||
expect(@deck.send(:layoutify, {layout: ['blah', 'apples']})).to \
|
||||
eq({layout: ['blah','apples'], x: [25, 35]})
|
||||
eq({layout: ['blah','apples'], x: [25, 35]})
|
||||
end
|
||||
|
||||
it "still has nils when not applied two different layouts differ in structure" do
|
||||
expect(@deck.send(:layoutify, {layout: ['apples', 'oranges']})).to \
|
||||
eq({layout: ['apples','oranges'], x: [35], y: [nil, 45]})
|
||||
eq({layout: ['apples','oranges'], x: [35], y: [nil, 45]})
|
||||
#...this might behavior that is hard to debug for users. Trying to come up with a warning or something...
|
||||
end
|
||||
|
||||
it "also looks up based on strings" do
|
||||
expect(@deck.send(:layoutify, {layout: 'blah'})).to \
|
||||
eq({layout: ['blah','blah'], x: [25, 25]})
|
||||
eq({layout: ['blah','blah'], x: [25, 25]})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ require 'spec_helper'
|
||||
require 'squib'
|
||||
require 'pp'
|
||||
|
||||
describe Squib do
|
||||
describe Squib do
|
||||
|
||||
context "all samples run without error" do
|
||||
it "should execute with no errors" do
|
||||
@@ -15,6 +15,6 @@ describe Squib do
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user