diff options
| author | Luke Kanies <luke@reductivelabs.com> | 2010-01-22 00:48:37 -0800 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | 2fa0a489e26fc2512783c67b1b4579a03f8a20a6 (patch) | |
| tree | 0c0157fe3e854fc5fbfa1bd94fc47c528dffef27 /test | |
| parent | aff59926bb8c8e7a136d6e87359e9857a4512da9 (diff) | |
Adding parameter validation to Puppet::Resource
This will allow us to remove all of the parameter
validation from the other Resource classes.
This is possible because resource types defined
in the language are visible outside of the parser,
via the environment.
This will enable lots of code removal and simplication.
Signed-off-by: Luke Kanies <luke@reductivelabs.com>
Diffstat (limited to 'test')
| -rwxr-xr-x | test/language/resource.rb | 8 | ||||
| -rw-r--r-- | test/lib/puppettest/fakes.rb | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/test/language/resource.rb b/test/language/resource.rb index 69e82fde4..c1d116f9e 100755 --- a/test/language/resource.rb +++ b/test/language/resource.rb @@ -67,17 +67,17 @@ class TestResource < PuppetTest::TestCase res.instance_variable_set("@ref", ref) klass = mock("class") ref.expects(:typeclass).returns(klass).times(4) - klass.expects(:validattr?).with("good").returns(true) + klass.expects(:valid_parameter?).with("good").returns(true) assert(res.send(:paramcheck, :good), "Did not allow valid param") # It's name or title - klass.expects(:validattr?).with("name").returns(false) + klass.expects(:valid_parameter?).with("name").returns(false) assert(res.send(:paramcheck, :name), "Did not allow name") - klass.expects(:validattr?).with("title").returns(false) + klass.expects(:valid_parameter?).with("title").returns(false) assert(res.send(:paramcheck, :title), "Did not allow title") # It's not actually allowed - klass.expects(:validattr?).with("other").returns(false) + klass.expects(:valid_parameter?).with("other").returns(false) res.expects(:fail) ref.expects(:type) res.send(:paramcheck, :other) diff --git a/test/lib/puppettest/fakes.rb b/test/lib/puppettest/fakes.rb index db6ca4d80..0aedb59f6 100644 --- a/test/lib/puppettest/fakes.rb +++ b/test/lib/puppettest/fakes.rb @@ -35,7 +35,7 @@ module PuppetTest def []=(param, value) param = symbolize(param) - unless @realresource.validattr?(param) + unless @realresource.valid_parameter?(param) raise Puppet::DevError, "Invalid attribute %s for %s" % [param, @realresource.name] end |
