summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKen Barber <ken@bob.sh>2011-08-05 08:25:03 +0100
committerKen Barber <ken@bob.sh>2011-08-05 08:25:03 +0100
commit681a1c7971d78c53dc9a0747ae4d983ff6b0d670 (patch)
tree3d56e35ffd165eb6d15bd54a06c41f8aa706fa1c /spec
parent35fefe186546427963d8c8a446fa98875d65ccad (diff)
Prep for stdlib merge
* Renamed load_yaml & load_json to parseyaml & parsejson * Renamed is_valid_* functions and remove the 'valid_'
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/parser/functions/is_domain_name_spec.rb (renamed from spec/unit/parser/functions/is_valid_domain_name_spec.rb)20
-rw-r--r--spec/unit/parser/functions/is_ip_address_spec.rb (renamed from spec/unit/parser/functions/is_valid_ip_address_spec.rb)16
-rw-r--r--spec/unit/parser/functions/is_mac_address_spec.rb (renamed from spec/unit/parser/functions/is_valid_mac_address_spec.rb)12
-rw-r--r--spec/unit/parser/functions/parsejson_spec.rb (renamed from spec/unit/parser/functions/load_json_spec.rb)8
-rw-r--r--spec/unit/parser/functions/parseyaml_spec.rb (renamed from spec/unit/parser/functions/load_yaml_spec.rb)8
5 files changed, 32 insertions, 32 deletions
diff --git a/spec/unit/parser/functions/is_valid_domain_name_spec.rb b/spec/unit/parser/functions/is_domain_name_spec.rb
index 3339447..ec7c7f5 100644
--- a/spec/unit/parser/functions/is_valid_domain_name_spec.rb
+++ b/spec/unit/parser/functions/is_domain_name_spec.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env rspec
require 'spec_helper'
-describe "the is_valid_domain_name function" do
+describe "the is_domain_name function" do
before :all do
Puppet::Parser::Functions.autoloader.loadall
end
@@ -11,45 +11,45 @@ describe "the is_valid_domain_name function" do
end
it "should exist" do
- Puppet::Parser::Functions.function("is_valid_domain_name").should == "function_is_valid_domain_name"
+ Puppet::Parser::Functions.function("is_domain_name").should == "function_is_domain_name"
end
it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_is_valid_domain_name([]) }.should( raise_error(Puppet::ParseError))
+ lambda { @scope.function_is_domain_name([]) }.should( raise_error(Puppet::ParseError))
end
it "should return true if a valid domain name" do
- result = @scope.function_is_valid_domain_name(["foo.bar.com"])
+ result = @scope.function_is_domain_name(["foo.bar.com"])
result.should(be_true)
end
it "should allow domain parts to start with numbers" do
- result = @scope.function_is_valid_domain_name(["3foo.2bar.com"])
+ result = @scope.function_is_domain_name(["3foo.2bar.com"])
result.should(be_true)
end
it "should allow domain to end with a dot" do
- result = @scope.function_is_valid_domain_name(["3foo.2bar.com."])
+ result = @scope.function_is_domain_name(["3foo.2bar.com."])
result.should(be_true)
end
it "should allow a single part domain" do
- result = @scope.function_is_valid_domain_name(["orange"])
+ result = @scope.function_is_domain_name(["orange"])
result.should(be_true)
end
it "should return false if domain parts start with hyphens" do
- result = @scope.function_is_valid_domain_name(["-3foo.2bar.com"])
+ result = @scope.function_is_domain_name(["-3foo.2bar.com"])
result.should(be_false)
end
it "should return true if domain contains hyphens" do
- result = @scope.function_is_valid_domain_name(["3foo-bar.2bar-fuzz.com"])
+ result = @scope.function_is_domain_name(["3foo-bar.2bar-fuzz.com"])
result.should(be_true)
end
it "should return false if domain name contains spaces" do
- result = @scope.function_is_valid_domain_name(["not valid"])
+ result = @scope.function_is_domain_name(["not valid"])
result.should(be_false)
end
diff --git a/spec/unit/parser/functions/is_valid_ip_address_spec.rb b/spec/unit/parser/functions/is_ip_address_spec.rb
index 2883aaa..98ce828 100644
--- a/spec/unit/parser/functions/is_valid_ip_address_spec.rb
+++ b/spec/unit/parser/functions/is_ip_address_spec.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env rspec
require 'spec_helper'
-describe "the is_valid_ip_address function" do
+describe "the is_ip_address function" do
before :all do
Puppet::Parser::Functions.autoloader.loadall
end
@@ -11,35 +11,35 @@ describe "the is_valid_ip_address function" do
end
it "should exist" do
- Puppet::Parser::Functions.function("is_valid_ip_address").should == "function_is_valid_ip_address"
+ Puppet::Parser::Functions.function("is_ip_address").should == "function_is_ip_address"
end
it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_is_valid_ip_address([]) }.should( raise_error(Puppet::ParseError))
+ lambda { @scope.function_is_ip_address([]) }.should( raise_error(Puppet::ParseError))
end
it "should return true if an IPv4 address" do
- result = @scope.function_is_valid_ip_address(["1.2.3.4"])
+ result = @scope.function_is_ip_address(["1.2.3.4"])
result.should(eq(true))
end
it "should return true if a full IPv6 address" do
- result = @scope.function_is_valid_ip_address(["fe80:0000:cd12:d123:e2f8:47ff:fe09:dd74"])
+ result = @scope.function_is_ip_address(["fe80:0000:cd12:d123:e2f8:47ff:fe09:dd74"])
result.should(eq(true))
end
it "should return true if a compressed IPv6 address" do
- result = @scope.function_is_valid_ip_address(["fe00::1"])
+ result = @scope.function_is_ip_address(["fe00::1"])
result.should(eq(true))
end
it "should return false if not valid" do
- result = @scope.function_is_valid_ip_address(["asdf"])
+ result = @scope.function_is_ip_address(["asdf"])
result.should(eq(false))
end
it "should return false if IP octets out of range" do
- result = @scope.function_is_valid_ip_address(["1.1.1.300"])
+ result = @scope.function_is_ip_address(["1.1.1.300"])
result.should(eq(false))
end
end
diff --git a/spec/unit/parser/functions/is_valid_mac_address_spec.rb b/spec/unit/parser/functions/is_mac_address_spec.rb
index 62e6fee..c9b9637 100644
--- a/spec/unit/parser/functions/is_valid_mac_address_spec.rb
+++ b/spec/unit/parser/functions/is_mac_address_spec.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env rspec
require 'spec_helper'
-describe "the is_valid_mac_address function" do
+describe "the is_mac_address function" do
before :all do
Puppet::Parser::Functions.autoloader.loadall
end
@@ -11,25 +11,25 @@ describe "the is_valid_mac_address function" do
end
it "should exist" do
- Puppet::Parser::Functions.function("is_valid_mac_address").should == "function_is_valid_mac_address"
+ Puppet::Parser::Functions.function("is_mac_address").should == "function_is_mac_address"
end
it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_is_valid_mac_address([]) }.should( raise_error(Puppet::ParseError))
+ lambda { @scope.function_is_mac_address([]) }.should( raise_error(Puppet::ParseError))
end
it "should return true if a valid mac address" do
- result = @scope.function_is_valid_mac_address(["00:a0:1f:12:7f:a0"])
+ result = @scope.function_is_mac_address(["00:a0:1f:12:7f:a0"])
result.should(eq(true))
end
it "should return false if octets are out of range" do
- result = @scope.function_is_valid_mac_address(["00:a0:1f:12:7f:g0"])
+ result = @scope.function_is_mac_address(["00:a0:1f:12:7f:g0"])
result.should(eq(false))
end
it "should return false if not valid" do
- result = @scope.function_is_valid_mac_address(["not valid"])
+ result = @scope.function_is_mac_address(["not valid"])
result.should(eq(false))
end
diff --git a/spec/unit/parser/functions/load_json_spec.rb b/spec/unit/parser/functions/parsejson_spec.rb
index 73a4566..26eea36 100644
--- a/spec/unit/parser/functions/load_json_spec.rb
+++ b/spec/unit/parser/functions/parsejson_spec.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env rspec
require 'spec_helper'
-describe "the load_json function" do
+describe "the parsejson function" do
before :all do
Puppet::Parser::Functions.autoloader.loadall
end
@@ -11,18 +11,18 @@ describe "the load_json function" do
end
it "should exist" do
- Puppet::Parser::Functions.function("load_json").should == "function_load_json"
+ Puppet::Parser::Functions.function("parsejson").should == "function_parsejson"
end
it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_load_json([]) }.should( raise_error(Puppet::ParseError))
+ lambda { @scope.function_parsejson([]) }.should( raise_error(Puppet::ParseError))
end
it "should convert JSON to a data structure" do
json = <<-EOS
["aaa","bbb","ccc"]
EOS
- result = @scope.function_load_json([json])
+ result = @scope.function_parsejson([json])
result.should(eq(['aaa','bbb','ccc']))
end
diff --git a/spec/unit/parser/functions/load_yaml_spec.rb b/spec/unit/parser/functions/parseyaml_spec.rb
index 2498d12..f9cb049 100644
--- a/spec/unit/parser/functions/load_yaml_spec.rb
+++ b/spec/unit/parser/functions/parseyaml_spec.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env rspec
require 'spec_helper'
-describe "the load_yaml function" do
+describe "the parseyaml function" do
before :all do
Puppet::Parser::Functions.autoloader.loadall
end
@@ -11,11 +11,11 @@ describe "the load_yaml function" do
end
it "should exist" do
- Puppet::Parser::Functions.function("load_yaml").should == "function_load_yaml"
+ Puppet::Parser::Functions.function("parseyaml").should == "function_parseyaml"
end
it "should raise a ParseError if there is less than 1 arguments" do
- lambda { @scope.function_load_yaml([]) }.should( raise_error(Puppet::ParseError))
+ lambda { @scope.function_parseyaml([]) }.should( raise_error(Puppet::ParseError))
end
it "should convert YAML to a data structure" do
@@ -24,7 +24,7 @@ describe "the load_yaml function" do
- bbb
- ccc
EOS
- result = @scope.function_load_yaml([yaml])
+ result = @scope.function_parseyaml([yaml])
result.should(eq(['aaa','bbb','ccc']))
end