Sha256: 844122c55bb6bfc1b9ef8b04d428a19df474b44d03b766ada62a970cd6a04973

Contents?: true

Size: 1.96 KB

Versions: 3

Compression:

Stored size: 1.96 KB

Contents

require 'spec_helper'
include VvmRb::Base

describe 'Validator' do

  describe 'check_hg' do
    def dummy_method ; end
    before_method(:dummy_method) { check_hg }

    context 'hg is installed' do
      before do
        Kernel.stub(:system).and_return(true)
      end

      it 'success to run the method' do
        expect(dummy_method).to be_nil
      end
    end

    context 'hg is not installed' do
      before do
        Kernel.stub(:system).and_return(false)
      end

      it 'cannot run the method' do
        expect(proc { dummy_method }).to raise_error
      end
    end
  end

  describe 'check_tag' do
    def dummy_method ; end
    before_method(:dummy_method) { check_tag }

    context 'available tag' do
      before { $*[1] = 'v7-4-050' }

      it 'success to run the method' do
        expect(dummy_method).to be_nil
      end
    end

    context 'hg is not installed' do
      before { $*[1] = '--enable-rubyinterp' }

      it 'cannot run the method' do
        expect(proc { dummy_method }).to raise_error
      end
    end
  end

  describe 'new_version?' do
    def dummy_method ; end
    before_method(:dummy_method) { new_version? }

    context 'new version' do
      before { $*[1] = 'v7-4-050' }

      it 'success to run the method' do
        expect(dummy_method).to be_nil
      end
    end

    context 'version is installed' do
      before { $*[1] = 'v7-4-103' }

      it 'cannot run the method' do
        expect(proc { dummy_method }).to raise_error
      end
    end
  end

  describe 'version_exist?' do
    def dummy_method ; end
    before_method(:dummy_method) { version_exist? }

    context 'version is installed' do
      before { $*[1] = 'v7-4-103' }

      it 'success to run the method' do
        expect(dummy_method).to be_nil
      end
    end

    context 'version is not installed' do
      before { $*[1] = 'v7-4-050' }

      it 'cannot run the method' do
        expect(proc { dummy_method }).to raise_error
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vvm-rb-0.0.12 spec/validator_spec.rb
vvm-rb-0.0.11 spec/validator_spec.rb
vvm-rb-0.0.10 spec/validator_spec.rb