(ns puppetlabs.puppetserver.cli.gem-test
  (:require [clojure.test :refer :all]
            [puppetlabs.puppetserver.cli.gem :refer :all]))

(deftest cli-gem-environment-test
  (let [fake-config {:jruby-puppet {:gem-home "/fake/path"}}
        fake-env {"PATH" "/bin:/usr/bin", "FOO_DEBUG" "1"}]
    (testing "The environment intended for the gem subcommand"
      (is (not (empty? ((cli-gem-environment fake-config fake-env) "PATH")))
          "has a non-empty PATH originating from the System")
      (is (= "/bin:/usr/bin" ((cli-gem-environment fake-config fake-env)
                               "PATH"))
          "does not modify the PATH environment variable")
      (is (= "/fake/path" ((cli-gem-environment fake-config fake-env)
                            "GEM_HOME"))
          "has GEM_HOME set to /fake/path from the provided config")
      (is (= "1" ((cli-gem-environment fake-config fake-env)
                      "FOO_DEBUG"))
          "preserves arbitrary environment vars for the end user"))))

(ns puppetlabs.puppetserver.cli.gem-test
  (:require [clojure.test :refer :all]
            [puppetlabs.puppetserver.cli.gem :refer :all]))

(deftest cli-gem-environment-test
  (let [fake-config {:jruby-puppet {:gem-home "/fake/path"}}
        fake-env {"PATH" "/bin:/usr/bin", "FOO_DEBUG" "1"}]
    (testing "The environment intended for the gem subcommand"
      (is (not (empty? ((cli-gem-environment fake-config fake-env) "PATH")))
          "has a non-empty PATH originating from the System")
      (is (= "/bin:/usr/bin" ((cli-gem-environment fake-config fake-env)
                               "PATH"))
          "does not modify the PATH environment variable")
      (is (= "/fake/path" ((cli-gem-environment fake-config fake-env)
                            "GEM_HOME"))
          "has GEM_HOME set to /fake/path from the provided config")
      (is (= "true" ((cli-gem-environment fake-config fake-env)
                      "JARS_NO_REQUIRE"))
          "has JARS_NO_REQUIRE set to true")
      (is (= "1" ((cli-gem-environment fake-config fake-env)
                      "FOO_DEBUG"))
          "preserves arbitrary environment vars for the end user"))))

Revert "(SERVER-262) Remove JARS_NO_REQUIRE failing test"
Revert "(SERVER-262) Remove JARS_NO_REQUIRE failing test"

This reverts commit 15acf46176e3b0f1f5ff11579633668542e20c15.

cprice404/puppetserver,rlinehan/puppetserver,puppetlabs/puppet-server,waynr/puppetserver,rlinehan/puppetserver,camlow325/puppet-server,kylog/puppet-server,waynr/puppet-server,rlinehan/puppetserver,jeffmccune/puppet-server,rlinehan/puppetserver,shrug/puppet-server,er0ck/puppetserver,dankreek/puppet-server,ahpook/puppet-server,stahnma/puppet-server,erikPrime/puppetserver,erikPrime/puppet-server,erikPrime/puppet-server,kylog/puppet-server,cprice404/puppet-server,rlinehan/puppet-server,jeffmccune/puppet-server,briancain/puppet-server,kylog/puppet-server,shrug/puppet-server,shrug/puppet-server,cgvarela/puppet-server,shrug/puppet-server,cgvarela/puppet-server,waynr/puppet-server,camlow325/puppetserver,ahpook/puppet-server,stahnma/puppet-server,erikPrime/puppetserver,dankreek/puppet-server,er0ck/puppetserver,dankreek/puppet-server,fpringvaldsen/puppet-server,cprice404/puppetserver,erikPrime/puppetserver,camlow325/puppetserver,erikPrime/puppet-server,er0ck/puppetserver,cprice404/puppet-server,waynr/puppetserver,camlow325/puppet-server,cgvarela/puppet-server,puppetlabs/puppetserver,waynr/puppet-server,camlow325/puppet-server,puppetlabs/puppetserver,fpringvaldsen/puppet-server,puppetlabs/puppetserver,ahpook/puppet-server,stahnma/puppet-server,briancain/puppet-server,camlow325/puppetserver,cprice404/puppet-server,briancain/puppet-server,cprice404/puppetserver,er0ck/puppetserver,rlinehan/puppet-server,puppetlabs/puppet-server,rlinehan/puppet-server,fpringvaldsen/puppet-server,camlow325/puppetserver,puppetlabs/puppet-server,jeffmccune/puppet-server,puppetlabs/puppetserver,waynr/puppetserver