Sha256: da189fa42f87f72fafe83b8011a753bc13c6904ca950d66eec0a79423a03c2d3
Contents?: true
Size: 1.48 KB
Versions: 4
Compression:
Stored size: 1.48 KB
Contents
require 'spec_helper' describe MiniGit do let(:git) { MiniGit::new } describe '#switches_for' do it 'passes regular arguments' do assert { git.switches_for('foo') == %w'foo' } assert { git.switches_for('foo', 'bar') == %w'foo bar' } assert { git.switches_for('foo', 'bar', 'baz quux') == ['foo', 'bar', 'baz quux'] } end it 'converts hashes to switches' do assert { git.switches_for(:foo => 'bar') == %w'--foo=bar' } assert { git.switches_for(:f => 'bar') == %w'-f bar' } assert { git.switches_for('foo', 'bar', :baz => 'quux') == %w'foo bar --baz=quux' } assert { git.switches_for({ :foo => 'bar' }, 'baz', 'quux') == %w'--foo=bar baz quux' } end it 'sorts switch names in hash' do assert { git.switches_for(:foo => 'bar', :baz => 'quux') == %w'--baz=quux --foo=bar' } end it 'converts underscores to dashes' do assert { git.switches_for(:foo_bar_baz => 'quux') == %w'--foo-bar-baz=quux' } end it 'recursively flattens the arrays' do assert { git.switches_for('foo', ['bar', 'baz'], 'quux') == %w'foo bar baz quux' } assert { git.switches_for('foo', ['bar', ['baz']], 'quux') == %w'foo bar baz quux' } assert { git.switches_for('foo', ['bar', :baz => 'quux'], 'xyzzy') == %w'foo bar --baz=quux xyzzy' } end it 'multiplies the switch if hash value is an array' do assert { git.switches_for(:foo => ['bar', 'baz', 'quux']) == %w'--foo=bar --foo=baz --foo=quux' } end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
minigit-0.0.4 | spec/minigit_spec.rb~ |
minigit-0.0.3 | spec/minigit_spec.rb~ |
minigit-0.0.2 | spec/minigit_spec.rb~ |
minigit-0.0.1 | spec/minigit_spec.rb~ |