Sha256: 4f70c42f7d11dd1be3921e3fb2d8fd925b220bef1a22814d5e445f558cba91f8

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 KB

Contents

$: << '../lib'
require 'spec_helper'
require 'yuyi'

Yuyi::Menu.new Yuyi.instance_variable_get('@path')

describe 'Roll Validator' do
  Yuyi::Menu.sources.each do |source|

    # require roll models first
    source.roll_models.each do |roll_model_name, roll_model_path|
      require roll_model_path
    end

    source_title = source.instance_variable_get('@name')

    describe source_title do
      source.rolls.each do |roll_name, roll_path|
        describe roll_name do
          before do
            # require roll_path
            load "#{roll_path}.rb", true
            @roll_class = Yuyi::Menu.rolls[roll_name].class
          end

          after do
            # unload class to test other sources of the same roll
            klass = @roll_class.to_s.scan(/[^:]+$/).first.to_sym
            Yuyi.send :remove_const, klass
          end

          it 'should define install' do
            expect(@roll_class.install).to be_a Proc
          end

          it 'should define uninstall' do
            expect(@roll_class.uninstall).to be_a Proc
          end

          it 'should define upgrade' do
            expect(@roll_class.upgrade).to be_a Proc
          end

          it 'should define installed?' do
            expect(@roll_class.installed?).to be_a Proc
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yuyi-1.1.7 spec/roll_validator.rb
yuyi-1.1.6 spec/roll_validator.rb
yuyi-1.1.5 spec/roll_validator.rb
yuyi-1.1.4 spec/roll_validator.rb
yuyi-1.1.3 spec/roll_validator.rb