summaryrefslogtreecommitdiffstats
path: root/spec/unit/interface
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-20 19:04:50 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-20 19:06:08 -0700
commit7db4793eac52cbbf9c5919597e8e3a6b0a7bbd38 (patch)
tree6d74e6b2f297bcd3c4c4b2ff961d1badd8bb2465 /spec/unit/interface
parenteeb82361de00f86f0840c2fcdd30a5e84c49232d (diff)
downloadpuppet-7db4793eac52cbbf9c5919597e8e3a6b0a7bbd38.tar.gz
puppet-7db4793eac52cbbf9c5919597e8e3a6b0a7bbd38.tar.xz
puppet-7db4793eac52cbbf9c5919597e8e3a6b0a7bbd38.zip
maint: clean up testing code a fraction...
This rewrites a block of identical tests down to a little table, then applies the test over that.
Diffstat (limited to 'spec/unit/interface')
-rwxr-xr-xspec/unit/interface/face_collection_spec.rb32
1 files changed, 10 insertions, 22 deletions
diff --git a/spec/unit/interface/face_collection_spec.rb b/spec/unit/interface/face_collection_spec.rb
index f9498cbb8..c3e43435c 100755
--- a/spec/unit/interface/face_collection_spec.rb
+++ b/spec/unit/interface/face_collection_spec.rb
@@ -25,28 +25,16 @@ describe Puppet::Interface::FaceCollection do
end
describe "::validate_version" do
- it 'should permit three number versions' do
- subject.validate_version('10.10.10').should == true
- end
-
- it 'should permit versions with appended descriptions' do
- subject.validate_version('10.10.10beta').should == true
- end
-
- it 'should not permit versions with more than three numbers' do
- subject.validate_version('1.2.3.4').should == false
- end
-
- it 'should not permit versions with only two numbers' do
- subject.validate_version('10.10').should == false
- end
-
- it 'should not permit versions with only one number' do
- subject.validate_version('123').should == false
- end
-
- it 'should not permit versions with text in any position but at the end' do
- subject.validate_version('v1.1.1').should == false
+ { '10.10.10' => true,
+ '1.2.3.4' => false,
+ '10.10.10beta' => true,
+ '10.10' => false,
+ '123' => false,
+ 'v1.1.1' => false,
+ }.each do |input, result|
+ it "should#{result ? '' : ' not'} permit #{input.inspect}" do
+ subject.validate_version(input).should(result ? be_true : be_false)
+ end
end
end