(#14515) Tests fail with mocha 0.11.4

Prior to this commit, these tests only worked with mocha 0.10.5 because
the tests were broken and trying to stub methods on nil, which mocha
0.11.4 no longer allows. After this commit, these tests work with both
mocha 0.10.5 and 0.11.4.
Fix stubbing on nil in some specs
Don't require mocha in spec_helper

Rspec will automatically require mocha, and it knows how to do it properly
depending on the mocha version. This eliminates spurious deprecation warnings
about how mocha is loaded.
Rename specs to end in _spec.rb
Avoid stubbing Thread::new due to issues in newer mocha

In mocha >= 0.11.0, unstubbing a method is done by defining a method that
calls the original method. Somehow this indirection causes issues when
Thread::new is stubbed, and the new thread does not have proper access to
local variables. This patch fixes this from both ends, by not stubbing
Thread::new and not using local variables in the test that was failing.
Check that function loading worked correctly.

In some odd circumstances - typically, just development errors - you can wind
up in a world where a function correctly loads but isn't available.

This ensures that the method is defined as expected and raises a clear, quick
error if not. The alternative is an unclear stack overflow raised because we
recurse forever through method_missing.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>

Conflicts:
	lib/puppet/parser/scope.rb
Clear Environment.current when calling Environment.clear

This makes Puppet::Node::Environment::clear properly clear all the environment
state. This reduces dependencies between tests due to leaked state. It also
moves the call to clear to happen before each test. This avoids issues where
tests set up stubs on settings, as the after block is called before stubs are
removed.
Add Puppet::Parser::Functions::clear for specs

Since functions uses class instance variables to track which functions are
loaded, we need to clear this between tests.
Merge pull request #1016 from pcarlisle/maint/2.7.x/mocha12

Maint/2.7.x/mocha12
Merge branch '2.7.x' into 3.x

* 2.7.x:
  Add Puppet::Parser::Functions::clear for specs
  Clear Environment.current when calling Environment.clear
  Check that function loading worked correctly.
  Avoid stubbing Thread::new due to issues in newer mocha
  Rename specs to end in _spec.rb
  Don't require mocha in spec_helper
  Fix stubbing on nil in some specs
  (#14515) Tests fail with mocha 0.11.4

Conflicts:
	spec/unit/network/http/webrick_spec.rb
	spec/unit/parser/functions/require_spec.rb
	spec/unit/parser/functions/template_spec.rb
Merge remote-tracking branch 'rahul/ticket/3.x/15569_fix_augeas_print_errors' into 3.x

* rahul/ticket/3.x/15569_fix_augeas_print_errors:
  (#15569) ensure that augeas prints parse errors.
(#8200) validate only if we can (especially path)

The global validate block is called even when `puppet resource zone` is
called without any further arguments, so we add a check
provider.get(:ensure) != :absent to make sure that we are indeed in
zone creation stage before trying to validate. This could have been
better done by `isrequired` method in parameter.rb however this is not
hooked up now, so we are uanble to use it..

The ip validation is refactored to make it clearer to read.