Sha256: 5fa98f86b2ddd639a69408bc077339484aa6bdcc56c5178da10c019d05567501

Contents?: true

Size: 948 Bytes

Versions: 2

Compression:

Stored size: 948 Bytes

Contents

require_relative '../../spec_helper'
require 'aequitas/rule'

module Aequitas
  describe Rule do
    let(:rule) { Rule.new(attribute_name, options) }
    let(:attribute_name) { :foo }
    let(:options) { Hash.new }

    describe '#initialize' do
      it 'sets #attribute_name to the first arg' do
        attribute_name = :foo
        assert_same attribute_name, Rule.new(attribute_name).attribute_name
      end

      it 'sets #custom_message to the :message option' do
        message = 'foo'
        assert_same message, Rule.new(:bar, message: message).custom_message
      end

      it 'initializes #guard with the :if and :unless options' do
        expected_guard = Rule::Guard.new(if: :a, unless: :b)
        assert_equal expected_guard, Rule.new(:bar, if: :a, unless: :b).guard
      end
    end

    describe '#validate' do
      
    end

    describe '#execute?' do
      
    end

    describe '#skip?' do
      
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aequitas-0.0.2 spec/unit/aequitas/rule_spec.rb
aequitas-0.0.1 spec/unit/aequitas/rule_spec.rb