Sha256: 5d125033f3781e22adbc23c2ade5b9b729e0da8925c9472268ba2619119c95c9

Contents?: true

Size: 695 Bytes

Versions: 3

Compression:

Stored size: 695 Bytes

Contents

require 'minarai/actions/base'

describe Minarai::Actions::Base do
  describe '::attribute' do
    let(:klass) do
      Class.new(Minarai::Actions::Base) do |_|
        attribute :destination, required: true, type: String
        def run
        end

        def complete?
        end
      end
    end

    context 'when valid attribute is recieved' do
      let(:klass_obj) { klass.new('destination' => 'path') }
      it { expect(klass_obj.error_messages).to eq [] }
    end

    context 'when required attribute is not existed' do
      let(:klass_obj) { klass.new({}) }
      it { expect(klass_obj.error_messages.first).to be_a Minarai::Errors::AttributeValidationError }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
minarai-0.0.3 spec/minarai/unit/actions/base_spec.rb
minarai-0.0.2 spec/minarai/unit/action/base_spec.rb
minarai-0.0.1 spec/minarai/unit/action/base_spec.rb