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.11.1 spec/mortar/local/jython_spec.rb
mortar-0.11.0 spec/mortar/local/jython_spec.rb
mortar-0.10.1 spec/mortar/local/jython_spec.rb
mortar-0.10.0 spec/mortar/local/jython_spec.rb
mortar-0.9.10 spec/mortar/local/jython_spec.rb
mortar-0.9.8 spec/mortar/local/jython_spec.rb
mortar-0.9.7 spec/mortar/local/jython_spec.rb
mortar-0.9.6 spec/mortar/local/jython_spec.rb
mortar-0.9.5 spec/mortar/local/jython_spec.rb
mortar-0.9.4 spec/mortar/local/jython_spec.rb
mortar-0.9.3 spec/mortar/local/jython_spec.rb
mortar-0.9.2 spec/mortar/local/jython_spec.rb
mortar-0.9.1 spec/mortar/local/jython_spec.rb
mortar-0.9.0 spec/mortar/local/jython_spec.rb
mortar-0.8.8 spec/mortar/local/jython_spec.rb
mortar-0.8.7 spec/mortar/local/jython_spec.rb
mortar-0.8.6 spec/mortar/local/jython_spec.rb
mortar-0.8.5 spec/mortar/local/jython_spec.rb
mortar-0.8.4 spec/mortar/local/jython_spec.rb
mortar-0.8.3 spec/mortar/local/jython_spec.rb