👮 space inside parens

This commit is contained in:
Andy Meneely
2016-03-17 23:42:09 -04:00
parent 310030eee4
commit 0f5b7d0f8e
7 changed files with 46 additions and 46 deletions
+5 -5
View File
@@ -20,7 +20,7 @@ describe Squib::Args::Draw do
it 'works when specified' do
draw.load!({}) # go right to defaults
expect(draw.stroke_width).to eq( [0.0] ) #ordinarily a non-zero according
expect(draw.stroke_width).to eq([0.0]) #ordinarily a non-zero according
end
end
@@ -57,25 +57,25 @@ describe Squib::Args::Draw do
it 'converts line caps to Cairo constants' do
args = { cap: :SQUARE }
draw.load! args
expect(draw).to have_attributes( cap: [Cairo::LINE_CAP_SQUARE] )
expect(draw).to have_attributes(cap: [Cairo::LINE_CAP_SQUARE])
end
it 'converts line join' do
args = { join: 'round' }
draw.load! args
expect(draw).to have_attributes( join: [Cairo::LINE_JOIN_ROUND] )
expect(draw).to have_attributes(join: [Cairo::LINE_JOIN_ROUND])
end
it 'allows fill_first stroke_strategy' do
args = { stroke_strategy: :FILL_first }
draw.load! args
expect(draw).to have_attributes( stroke_strategy: [:fill_first] )
expect(draw).to have_attributes(stroke_strategy: [:fill_first])
end
it 'allows stroke_first stroke_strategy' do
args = { stroke_strategy: ' stroke_FIRST ' }
draw.load! args
expect(draw).to have_attributes( stroke_strategy: [:stroke_first] )
expect(draw).to have_attributes(stroke_strategy: [:stroke_first])
end
it 'disallows anything not stroke_first and fill_first' do
+27 -27
View File
@@ -7,146 +7,146 @@ describe Squib::Args::Paragraph do
context 'str validator' do
it 'converts everything to string' do
para.load!( { str: 5 } )
para.load!({ str: 5 })
expect(para.str).to eq ['5']
end
end
context 'font validator' do
it 'uses deck font by default' do
para.load!( {} )
para.load!({})
expect(para.font).to eq ['FooFont 32']
end
it 'uses system default font when deck font is :default' do
para = Squib::Args::Paragraph.new(:default)
para.load!( {} )
para.load!({})
expect(para.font).to eq [Squib::DEFAULT_FONT]
end
it 'uses specified font when given' do
para.load!( { font: 'MyFont 8' })
para.load!({ font: 'MyFont 8' })
expect(para.font).to eq ['MyFont 8']
end
end
context 'align validator' do
it 'converts to pango left' do
para.load!( { align: :left } )
para.load!({ align: :left })
expect(para.align).to eq [Pango::ALIGN_LEFT]
end
it 'converts to pango right' do
para.load!( { align: :RIGHT } )
para.load!({ align: :RIGHT })
expect(para.align).to eq [Pango::ALIGN_RIGHT]
end
it 'converts to pango center' do
para.load!( { align: 'center' } )
para.load!({ align: 'center' })
expect(para.align).to eq [Pango::ALIGN_CENTER]
end
it 'raises an exception on anything else' do
expect { para.load!( { align: 'foo' } ) }.to raise_error(ArgumentError, 'align must be one of: center, left, right')
expect { para.load!({ align: 'foo' }) }.to raise_error(ArgumentError, 'align must be one of: center, left, right')
end
end
context 'wrap validator' do
it 'converts to pango wrap word' do
para.load!( { wrap: 'word' } )
para.load!({ wrap: 'word' })
expect(para.wrap).to eq [Pango::WRAP_WORD]
end
it 'converts to pango wrap char' do
para.load!( { wrap: 'WORD_ChAr' } )
para.load!({ wrap: 'WORD_ChAr' })
expect(para.wrap).to eq [Pango::WRAP_WORD_CHAR]
end
it 'converts to pango wrap char on true' do
para.load!( { wrap: true } )
para.load!({ wrap: true })
expect(para.wrap).to eq [Pango::WRAP_WORD_CHAR]
end
it 'converts to pango wrap char with false' do
para.load!( { wrap: false } )
para.load!({ wrap: false })
expect(para.wrap).to eq [Pango::WRAP_CHAR]
end
it 'raises an exception on anything else' do
expect { para.load!( { wrap: 'foo' }) }.to raise_error(ArgumentError, 'wrap must be one of: word, char, word_char, true, or false')
expect { para.load!({ wrap: 'foo' }) }.to raise_error(ArgumentError, 'wrap must be one of: word, char, word_char, true, or false')
end
end
context 'ellipsize validator' do
it 'converts to pango on none and false' do
para.load!( { ellipsize: 'none' } )
para.load!({ ellipsize: 'none' })
expect(para.ellipsize).to eq [Pango::Layout::ELLIPSIZE_NONE]
end
it 'converts to pango with start' do
para.load!( { ellipsize: :StArt } )
para.load!({ ellipsize: :StArt })
expect(para.ellipsize).to eq [Pango::Layout::ELLIPSIZE_START]
end
it 'converts to pango middle' do
para.load!( { ellipsize: 'middle' } )
para.load!({ ellipsize: 'middle' })
expect(para.ellipsize).to eq [Pango::Layout::ELLIPSIZE_MIDDLE]
end
it 'converts to pango end' do
para.load!( { ellipsize: 'END' } )
para.load!({ ellipsize: 'END' })
expect(para.ellipsize).to eq [Pango::Layout::ELLIPSIZE_END]
end
it 'raises an exception on anything else' do
expect { para.load!( { ellipsize: 'foo' }) }.to raise_error(ArgumentError, 'ellipsize must be one of: none, start, middle, end, true, or false')
expect { para.load!({ ellipsize: 'foo' }) }.to raise_error(ArgumentError, 'ellipsize must be one of: none, start, middle, end, true, or false')
end
end
context 'justify validator' do
it 'allows nil' do
para.load!( { justify: nil } )
para.load!({ justify: nil })
expect(para.justify).to eq [nil]
end
it 'can be true' do
para.load!( { justify: true } )
para.load!({ justify: true })
expect(para.justify).to eq [true]
end
it 'can be false' do
para.load!( { justify: false } )
para.load!({ justify: false })
expect(para.justify).to eq [false]
end
it 'raises an exception on anything else' do
expect { para.load!( { justify: 'false' }) }.to raise_error(ArgumentError, 'justify must be one of: nil, true, or false')
expect { para.load!({ justify: 'false' }) }.to raise_error(ArgumentError, 'justify must be one of: nil, true, or false')
end
end
context 'spacing validator' do
it 'allows nil' do
para.load!( { spacing: nil } )
para.load!({ spacing: nil })
expect(para.spacing).to eq [nil]
end
it 'is converted to Pango space' do
para.load!( { spacing: 519 } )
para.load!({ spacing: 519 })
expect(para.spacing).to eq [Pango::SCALE * 519.0]
end
it 'raises an exception if not a float' do
expect { para.load!( { spacing: /foo/ }) }.to raise_error(ArgumentError, 'spacing must be a number or nil')
expect { para.load!({ spacing: /foo/ }) }.to raise_error(ArgumentError, 'spacing must be a number or nil')
end
end
context 'valign validator' do
it 'converts top' do
para.load!( { valign: :top } )
para.load!({ valign: :top })
expect(para.valign).to eq ['top']
end
it 'raises an exception if not one of the three' do
expect { para.load!( { valign: 'foo' }) }.to raise_error(ArgumentError, 'valign must be one of: top, middle, bottom')
expect { para.load!({ valign: 'foo' }) }.to raise_error(ArgumentError, 'valign must be one of: top, middle, bottom')
end
end
+4 -4
View File
@@ -8,7 +8,7 @@ describe Squib::Args::Sheet do
it 'works when specified' do
sheet.load!({}) # go right to defaults
expect(sheet.file).to eq( 'foo' ) # dsl method default override
expect(sheet.file).to eq('foo') # dsl method default override
end
end
@@ -31,19 +31,19 @@ describe Squib::Args::Sheet do
it 'computes properly on non-integer' do
opts = { columns: 1, rows: :infinite }
sheet.load! opts
expect(sheet).to have_attributes( columns: 1, rows: 4 )
expect(sheet).to have_attributes(columns: 1, rows: 4)
end
it 'computes properly on unspecified rows' do
opts = { columns: 1 }
sheet.load! opts
expect(sheet).to have_attributes( columns: 1, rows: 4 )
expect(sheet).to have_attributes(columns: 1, rows: 4)
end
it 'computes properly on unspecified, too-big column' do
opts = {}
sheet.load! opts
expect(sheet).to have_attributes( columns: 5, rows: 1 )
expect(sheet).to have_attributes(columns: 5, rows: 1)
end
it 'fails on a non-integer column' do