Sha256: 53ad9eb3d251d9144ac778f49e6095b91699db8b3996b43e90f4099c3bf1d9a4

Contents?: true

Size: 1.88 KB

Versions: 91

Compression:

Stored size: 1.88 KB

Contents

#
# Copyright 2012 Mortar Data Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require 'spec_helper'
require 'fakefs/spec_helpers'
require 'mortar/local/jython'



module Mortar::Local
  describe Jython do

    context("update") do

      it "removes existing install and does install" do
        install_dir = "/foo/bar/jython"
        jython = Mortar::Local::Jython.new
        mock(jython).jython_directory.returns(install_dir)
        mock(jython).install
        FakeFS do
          FileUtils.mkdir_p(install_dir)
          expect(File.directory?(install_dir)).to be_true
          jython.update
          expect(File.directory?(install_dir)).to be_false
        end
      end

    end

    context "should_install" do

      it "is true if the directory does not exist" do
        install_dir = "/foo/bar/jython"
        jython = Mortar::Local::Jython.new
        mock(jython).jython_directory.returns(install_dir)
        FakeFS do
          FileUtils.mkdir_p(install_dir)
          expect(jython.should_install).to be_false
        end
      end

      it "is false if the directory already exists" do
        install_dir = "/foo/bar/jython"
        jython = Mortar::Local::Jython.new
        mock(jython).jython_directory.returns(install_dir)
        FakeFS do
          FileUtils.rm_rf(install_dir, :force => true)
          expect(jython.should_install).to be_true
        end
      end

    end

  end
end

Version data entries

91 entries across 91 versions & 1 rubygems

Version Path
mortar-0.15.47 spec/mortar/local/jython_spec.rb
mortar-0.15.46 spec/mortar/local/jython_spec.rb
mortar-0.15.45 spec/mortar/local/jython_spec.rb
mortar-0.15.44 spec/mortar/local/jython_spec.rb
mortar-0.15.43 spec/mortar/local/jython_spec.rb
mortar-0.15.42 spec/mortar/local/jython_spec.rb
mortar-0.15.41 spec/mortar/local/jython_spec.rb
mortar-0.15.40 spec/mortar/local/jython_spec.rb
mortar-0.15.39 spec/mortar/local/jython_spec.rb
mortar-0.15.38 spec/mortar/local/jython_spec.rb
mortar-0.15.37 spec/mortar/local/jython_spec.rb
mortar-0.15.36 spec/mortar/local/jython_spec.rb
mortar-0.15.35 spec/mortar/local/jython_spec.rb
mortar-0.15.34 spec/mortar/local/jython_spec.rb
mortar-0.15.33 spec/mortar/local/jython_spec.rb
mortar-0.15.32 spec/mortar/local/jython_spec.rb
mortar-0.15.31 spec/mortar/local/jython_spec.rb
mortar-0.15.30 spec/mortar/local/jython_spec.rb
mortar-0.15.29 spec/mortar/local/jython_spec.rb
mortar-0.15.28 spec/mortar/local/jython_spec.rb